Sat Feb 23 14:20:42 CET 2013
This is the draft for the interface of a not-quite prolog language:
unification + backtracking (as `unify-or'), but no support for
"functions", i.e. expressing a != b is not possible.
However, it does look like this is enough to solve the problem.
I wonder if there is a real prolog-like language for Racket. Yep
there is .
EDIT: I was able to express the problem as a racklog problem.
However, due to the variable number of logic variables, this seems to
need a 2-phase approach:
- Convert AI higher order syntax to Scheme syntax (Racklog)
Probably there is a list approach to do this.. Somehow encode the
predicates so they operate over lists?
I guess this is always possible with symbols. I.e. write the whole
thing in one predicate, but then there still needs to be input. It
seems the static nature is just part of the deal..
Yeah this can't be so limiting. It's just me being inexperienced with
logic programming and data structures.
After takig a look at the source to the definition of the `%which'
form, it seems there is little magic. Variables can be created using
`(_)', and the which form could just return a list bound to a dummy
(let ((x (_))
(%and (%= $ (list x y))
(%member x '(1 2))
(%member y '(1 2)))))
So let's try to build the clause like this.