Scheme (Guile) Source Code
; Author: Hannes du Plooy
; Date: 20 Sep 2016
; Objective: To solve the towers of hanoi with number of discs provided in the arguments to calling the program
(define (hanoi source dest other discs)
(when (> discs 0)
(hanoi source other dest (1- discs))
(display "Move ")(display source)(display " to ")(display dest)(newline)
(hanoi other dest source (1- discs))))
(if (< (length (command-line)) 2)
(display "Please provide number of discs!\n")
(hanoi 0 2 1 (string->number (cadr (command-line)))))