Hacker News new | ask | show | jobs
by Ezra 6307 days ago
Basically what's going on is this, but with lists:

3 + 5 = X?

X = 8

3 + X = 8?

X = 5

5 + X = 8?

X = 3

In most programming languages, you can't infer a parameter by specifying a result.

(Though that's not strictly what's going on here, either)

You could further say something like X + Y = 8 and get

X = 0, Y = 8

X = 1, Y = 7

etc. for some definitions.

Which is, as the OP was getting at, sometimes incredibly useful.

1 comments

Ah thanks for clarifying. Now it makes sense. Are there any real world applications for this, for us mortal web developers?
If you're asking "are there potentially awesome applications of this?" then the answer is probably "yes".

If you're asking "is there anything in the wild that I would know of and uses this?" then the answer is probably "no".

Most of the prolog projects I've ever seen are pretty inbred; implementing compilers or interpreters, hooks for another language-type things. Though it must be said that I'm not deeply embedded in the prolog community.

In my 4th year university project we worked on an expert system for a card game in Prolog... For doing an expert system based AI, prolog is pretty good...