Towers of Hanoi: Difference between revisions

Content added Content deleted
Line 3,664: Line 3,664:
</pre>
</pre>


=={{header|lambdatalk}}==
=={{header|Lambdatalk}}==


<syntaxhighlight lang="scheme">
<syntaxhighlight lang="scheme">
Line 3,679: Line 3,679:


{def hanoi
{def hanoi
{lambda {:h :a :b :c}
{lambda {:disks :a :b :c}
{if {A.empty? :h}
{if {A.empty? :disks}
then
then
else {hanoi {A.rest :h} :a :c :b}
else {hanoi {A.rest :disks} :a :c :b}
{div > move {A.first :h} from :a to :b}
{div > move {A.first :disks} from :a to :b}
{hanoi {A.rest :h} :c :b :a} }}}
{hanoi {A.rest :disks} :c :b :a} }}}
-> hanoi
-> hanoi