towers of hanoi | Takeuchi function | combinations of a set | letrec macro
;;; LTAK (list-based TAK) benchmark (let* ((six (quote (1 2 3 4 5 6))) (twelve (append six six)) (eighteen (append six twelve))) (labels ((ltak (x y z) (cond ((not-longer x y) z) (t (ltak (ltak (cdr x) y z) (ltak (cdr y) z x) (ltak (cdr z) x y))))) (not-longer (a b) (cond ((eq nil a)) ((eq nil b) nil) (t (not-longer (cdr a) (cdr b))))) (ntimes (n) (cond ((null n)) (t (print (ltak eighteen twelve six)) (ntimes (cdr n)))))) (ntimes '(1 2 3 4 5 6 7 8 9 10))))