Here's another prolog-to-pilog translation, this time from John Fisher's 
excellent "Prolog Tutorial, 2.19 Actions and plans" 
http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_19.html 

prolog:
 http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_19pl.txt 

to pilog:
  http://victoriafamilyrobotics.net/vfr1/media/sec2_19.l

This was an easier example than golog.l, but I definitely needed some of the 
call-related tricks I learned before! 

To run it, for example, here's do([on(c,b),on(b,a),on(a,table)]) -- shown about 
three-fourths of the way down the tutorial page -- which is defined as test t_4 
in the pilog source file sec2_19.l

# ~/lisp/miniPicoLisp
$ ./pil sec2_19.l  -t_4 -bye
1 (do ((on c b) (on b a) (on a table)))
1 (do_all ((on c b) (on b a) (on a table)) ((on c b) (on b a) (on a table)))
2 (do_all ((on c b) (on b a) (on a table)) ((on c b) (on b a) (on a table)))
1 (achieve (on c b))
1 (do_all ((on c b) (on b a) (on a table)) ((on c b) (on b a) (on a table)))
1 (do_all ((on b a) (on a table)) ((on c b) (on b a) (on a table)))
2 (do_all ((on b a) (on a table)) ((on c b) (on b a) (on a table)))
1 (achieve (on b a))
1 (do_all ((on c b) (on b a) (on a table)) ((on c b) (on b a) (on a table)))
2 (do_all ((on c b) (on b a) (on a table)) ((on c b) (on b a) (on a table)))
1 (achieve (on c b))
1 (do_all ((on c b) (on b a) (on a table)) ((on c b) (on b a) (on a table)))
1 (do_all ((on b a) (on a table)) ((on c b) (on b a) (on a table)))
1 (do_all ((on a table)) ((on c b) (on b a) (on a table)))
3 (do_all NIL ((on c b) (on b a) (on a table)))
on/move:
1 (be on (a table))
2 (be on (b a))
3 (be on (c b))
1 (be move (a b table))
2 (be move (b c table))
3 (be move (c table b))
4 (be move (c b table))
5 (be move (b table a))
6 (be move (c table b))


Cheers,

Doug


-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to