>
> Is this also useful for implementing something like Datalog? If yes,
> in what ways?
>
> Regards,
> Shantanu
I don't know for Datalog but for Prolog.
Imagine you have
parent(a,b).
parent(b,c).
ancestor(X,Y) :- parent(X,Z) , ancestor(Z,Y). (1)
ancestor(X,Y) :- parent(X,Y). (2)
Now you have the goal:
ancestor(a,V).
to apply the rule (1) you must unify ancestor(a,V) with ancestor(X,Y).
It gives you : {X -> a; V ->Y}
Then, you must unify parent(X,Z) with either parent(a,b) or parent(b,c).
Only the first one is possible knowing X->a and you get back:
{X->A,V->Y, Z->b}...
and so on.
Prolog alternates branching point with an unification of the goal and
the result of the rules....
(and of course backtracking)
Hopes that helps a bit,
Nicolas.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en