hanoi.l (508B)
1 # 19jul13abu 2 # (c) Software Lab. Alexander Burger 3 4 # Lisp 5 (de hanoi (N) 6 (move N 'left 'center 'right) ) 7 8 (de move (N A B C) 9 (unless (=0 N) 10 (move (dec N) A C B) 11 (println 'Move 'disk 'from 'the A 'to 'the B 'pole) 12 (move (dec N) C B A) ) ) 13 14 # Pilog 15 (be hanoi (@N) 16 (move @N left center right) ) 17 18 (be move (0 @ @ @) T) 19 20 (be move (@N @A @B @C) 21 (^ @M (dec (-> @N))) 22 (move @M @A @C @B) 23 (^ @ (println 'Move 'disk 'from 'the (-> @A) 'to 'the (-> @B) 'pole)) 24 (move @M @C @B @A) )