僕の備忘録(PC、UN*X、ネットワーク関連が中心)なんです。 自分の書いたところは適当(な時とか)に書き換えますので御了承を。
丸写しより、0.1歩前進。 引数にatomが来たら、黙って#fを。
(define atom? (lambda (x) (and (not (pair? x)) (not (null? x))))) (define lat? (lambda (l) (cond ((atom? l) #f) ((null? l) #t) ((atom? (car l)) (lat? (cdr l))) (else #f)))
前に書いたのと、同じ...かと思ったが、違った。
(define allplus (lambda (l) (cond ((null? l) 0) (else (+ (car l) (allplus (cdr l))))))) (allplus '(1 2 3 4)) 10
掛け算にする時は、((null? l) 1)か。 それにしても、再帰による繰り返し処理は、 なかなか頭に入らない。
リンクはご自由にどうぞ。でもURLや内容が変った場合はあしからず。
index.htmlは ここから。