The Towers of Hanoi as a Yorick program.

According to the Yorick website:

Yorick is an interpreted programming language, designed for postprocessing or steering large scientific simulation codes. Smaller scientific simulations or calculations, such as the flow past an airfoil or the motion of a drumhead, can be written as standalone Yorick programs. The language features a compact syntax for many common array operations, so it processes large arrays of numbers very efficiently. Unlike most interpreters, which are several hundred times slower than compiled code for number crunching, Yorick can approach to within a factor of four or five of compiled speed for many common tasks. Superficially, Yorick code resembles C code, but Yorick variables are never explicitly declared and have a dynamic scoping similar to many Lisp dialects. The Yorick language is designed to be typed interactively at a keyboard, as well as stored in files for later use. Yorick includes an interactive graphics package, and a binary file package capable of translating to and from the raw numeric formats of all modern computers.

/* * The Towers Of Hanoi * Yorick * Copyright (C) 2003 Amit Singh. All Rights Reserved. * * * Last tested under Yorick version 1.4 * * * Usage: * * % yorick -i hanoi.i * > hanoi(3) * */ func dohanoi(n, f, u, t) { if (n > 0) { ret = dohanoi(n - 1, f, t, u) ret = write(f, " --> ", t) ret = dohanoi(n - 1, u, f, t) } return } func hanoi(n) { if (n > 0) { ret = dohanoi(n, 1, 2, 3) } else { ret = write("usage: hanoi n, n > 0\n") } return }