K
The Towers of Hanoi as a K program.
K is a high level system programming language available for Windows, Solaris, Linux, and maybe a few other Unix flavors upon request. It is mixture of APL, a functional programming language, and many unique features not found elsewhere. The K system is produced by Kx. They produce the language and one of the fastest commercial relational database available, KDB -- written in K.
/ The Towers Of Hanoi
/ K
/ Copyright (C) 2003 Amit Singh. All Rights Reserved.
/ http://hanoi.kernelthread.com
/
/ Last tested under K 2.95t
/ http://www.kx.com
/
/ Usage:
/ % k hanoi.k
/ ... Copyright messages ...
/ hanoi[3]
H: { :[x > 0; H[x - 1; y; 6 - (y + z)], y, z, 0, H[x - 1; 6 - (y + z); z]; ()] }
hanoi: { :[x > 0; H[x; 1; 3]] }