src/hanoi.lisp @ 5c5070c21269

Add little immutable struct thing
author Steve Losh <steve@stevelosh.com>
date Tue, 17 Jan 2017 18:37:07 +0000
parents 09407f2a9764
children 6eccaf72df12
(in-package :sand.hanoi)

(defun move (disc from to)
  (format t "Move disc ~D from ~D to ~D~%" disc from to))

(defun hanoi (n)
  (recursively ((disc n)
                (from 1)
                (to 3)
                (using 2))
    (when (plusp disc)
      (recur (1- disc) from using to)
      (move disc from to)
      (recur (1- disc) using to from)))
  (values))