kernelthread.com

CLAIRE

The Towers of Hanoi as a CLAIRE program.

According to the CLAIRE website:

Claire is an object-oriented language designed to express complex algorithms in an elegant manner. Some of its features are:

// The Towers Of Hanoi // CLAIRE // Copyright (C) 2003 Amit Singh. All Rights Reserved. // http://hanoi.kernelthread.com // // Last tested under CLAIRE 3.3.14 // http://groups.yahoo.com/group/claireprogramminglanguage/ // // Usage: // % sclaire # launch the CLAIRE environment // claire> load("hanoi") # load hanoi.cl // claire> hanoi(3) # run with 3 disks // [ H(n:integer, f:integer, u:integer, t:integer) : void -> if (n > 0) ( H(n - 1, f, t, u), printf("~S --> ~S\n", f, t), H(n - 1, u, f, t) ) else ( true ) ] [ hanoi(n:integer) : void -> if (n > 0) ( H(n, 1, 2, 3) ) ]

Download

hanoi.cl