(define rotate
(lambda (ls)
(define subrotate
(lambda (head tail res)
(if (null? tail)
res
(subrotate (append head (list (car tail)))
(cdr tail)
(cons (append tail head) res)))))
(if (null? ls)
ls
(subrotate '() ls '())))) (rotate '(a b c d e))
リスト(abcde)の場合、((abcde)(bcdea)(cdeab)(deabc)(eabcd))を出力する関数を作成したいのですが、その関数を実行すると(eabcd)(deabc)..... ..
この機能は次のようにアクティブになると思います
しっぽ | 頭 | 解像度
'() | (アブデ) | '()
| | (bcde) | (ちなみに)
(アブ) | (cde) | (cdeab)
(abc) | (デ) | (deabc)
(abcd) | (e) | (eabcd)
(アブデ) | () | (abcde)
印刷(abcde)のみを期待していますが、結果はそうではありません。これを変更するにはどうすればよいですか? また、すべての回転を印刷するのはなぜですか?