From: Mac Huang
Subject: how to solve "tower of hanoi"
Date: 
Message-ID: <4d5dqd$ak7@serv.hinet.net>
hi everyone:
	I wrote a LISP program to slove "tower of hanoi" but it didn't work,
	because I don't know how to output the moving steps.
	Is there anyone can help me finish this?
	thanks a lot
	the following is my source code:
	
(defun hanoi(disk_no source intermediate destination)
       (cond  (
                (> disk_no 1)
                (hanoi (- disk_no 1) source destination intermediate)
              )
       )
       '(source destination)	;<---------want to display out here,
       (cond  (
                (> disk_no 1)
                (hanoi (- disk_no 1) intermediate source destination)
              )
       )

)

�4�(Huang Cheng-Chu; Mac Huang)
Information System Department,
Information Enginerring Graduate School of Tatung Institution of Technology
···············@pc2.hinet.net                                            
From: Thomas A. Russ
Subject: Re: how to solve "tower of hanoi"
Date: 
Message-ID: <TAR.96Jan16075839@hobbes.ISI.EDU>
In article <··········@serv.hinet.net> ········@pc2.hinet.net (Mac Huang) writes:
 > 	I wrote a LISP program to slove "tower of hanoi" but it didn't work,
 > 	because I don't know how to output the moving steps.
 > 	the following is my source code:
 > 	
 > (defun hanoi(disk_no source intermediate destination)
 >        (cond  (
 >                 (> disk_no 1)
 >                 (hanoi (- disk_no 1) source destination intermediate)
 >               )
 >        )
 >        '(source destination)	;<---------want to display out here,

          (print (list source destination))

If you do (print '(source destination)) instead, it will always print
the following literal:

     (SOURCE DESTINATION)


 >        (cond  (
 >                 (> disk_no 1)
 >                 (hanoi (- disk_no 1) intermediate source destination)
 >               )
 >        )
 > 
 > )

--
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu