(defun single? (ls) (and (not (null ls)) (null (cdr ls)))) (defun intersperse (item ls) (pair-fold1 #'(lambda (pr acc) (if (single? pr) (cons (car pr) acc) (cons item (cons (car pr) acc)))) '() (reverse ls)))
ELISP> (intersperse " " '(1 2 3)) (1 " " 2 " " 3)
0 件のコメント:
コメントを投稿