コードは以下の通り。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-1) | |
(define (dotted-list->list dl . terminal-fun) | |
(let-optionals* terminal-fun ((terminal-fun (lambda _ '()))) | |
(unfold not-pair? car cdr dl terminal-fun))) | |
(dotted-list->list '(a b . c)) | |
;; (a b) | |
(dotted-list->list '(a b . c) identity) | |
;; (a b . c) | |
(dotted-list->list '(a b . c) (lambda (term) | |
(list term))) | |
;; (a b c) | |
0 件のコメント:
コメントを投稿