by Ezra · 17y ago · 0 comments
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.
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.