リストを操作する関数: square-list
> (define (square-list lst)
    (if (null? lst)
        (list)
        (cons (* (car lst) (car lst))
              (square-list (cdr lst)))))
> (trace square-list)
> (square-list (list 1 2))
| > (square-list '(1 2))      ;  'の意味は後述
| | > (square-list '(2))
| | | > (square-list '())
| | | ()
| | (4)
| (1 4)
(1 4)

一覧 前へ 次へ