当前位置: 代码迷 >> 综合 >> sicp 习题 2.23
  详细解决方案

sicp 习题 2.23

热度:15   发布时间:2024-01-11 16:32:55.0
#lang planet neil/sicp
(define lst (list 57 321 88))
(define thing (lambda (x) (newline) (display x)))(define (for-each thing lst)(cond ((not (null? lst))(thing (car lst))                     (for-each thing (cdr lst)))))

运行结果:

Welcome to DrRacket, version 5.3.3 [3m].
Language: planet neil/sicp; memory limit: 512 MB.
> (for-each thing lst)


57
321
88