Help us understand the problem. What is going on with this article?

メタマジック・ゲームからハノイの塔写経

More than 5 years have passed since last update.
(define carry-one-disk
  (lambda (sn dn)
    (string-append sn dn)))

(define move-tower
  (lambda (n sn dn hn)
    (cond ((= n 1) (carry-one-disk sn dn))
          (else (list (move-tower (sub1 n) sn hn dn)
                      (carry-one-disk sn dn)
                      (move-tower (sub1 n) hn dn sn))))))


(define carry-one-disk-flatten
  (lambda (sn dn)
    (list (string-append sn dn))))

(define move-tower-flatten
  (lambda (n sn dn hn)
    (cond ((= n 1) (carry-one-disk-flatten sn dn))
          (else (append (move-tower-flatten (sub1 n) sn hn dn)
                      (carry-one-disk-flatten sn dn)
                      (move-tower-flatten (sub1 n) hn dn sn))))))


kametaro
今年でエンジニア生活22年目 COBOLer | SIer | fujisan.co.jp | dely.jp | retail-ai.jp url.joor.net/cke url.joor.net/ckf App/サーバサイド/Cloud データエンジニア/機械学習 数学好き
https://note.com/long10
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away