The Little Schemer, 4th Edition と The Seasoned Schemer に出てくる、atom?手続き。
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
(define (atom? a) | |
(and (not (pair? a)) | |
(not (null? a)))) | |
(define (atom? a) | |
(every (cut <> a) | |
(map (cut compose not <>) | |
`(,pair? ,null?)))) | |
(define (atom? a) | |
(every (cut <> a) | |
(map complement | |
`(,pair? ,null?)))) | |
上が本の序文に記載されているもので、下が書き直したもの。
0 件のコメント:
コメントを投稿