next up previous
Next: Looping Behaviour Up: No Title Previous: Extracting the Path from

node2path in Action

?- node2path( n(ls, n(cc, n(gp, n(bs, -1)))),Z).

Z = [ls, cc, gp, bs]

Note that the path is reversed. To reverse it we can use the builtin reverse/2.

Exercise. Give a definition of reverse/2.



Mike Rosner
Fri Mar 5 16:50:53 MET 1999