Source of Nothingness - 2006-05-23 「A・E・H・R・T」でできるすべての文字列を表示するプログラム

* 2006-05-23 「A・E・H・R・T」でできるすべての文字列を表示するプログラム

http://d.hatena.ne.jp/tamago_girai/20060522#p1

pushが失敗だった。訂正版。
より簡潔に。再帰が一回分増えるのがアレだったんだけど、きれいな解答ならこちらかな。
(defun a-e-h-r-t (rest &optional pool)
  (if (not rest)
      (format t "~{~A~}~%" (reverse pool))
    (dolist (x rest)
      (a-e-h-r-t (remove x rest) (cons x pool)))))
(a-e-h-r-t '(a e h r t))

update : 2006-05-23 (Tue) 02:18:00