(wat-aro)

無職から有職者にランクアップしました

SICP 問題 2.28

(define x (list (list 1 2) (list 3 4)))

(define (fringe l)
  (cond ((null? l) nil)
        ((pair? (car l)) (append (fringe (car l))
                                 (fringe (cdr l))))
        (else (cons (car l) (fringe (cdr l))))))
gosh> (fringe x)
(1 2 3 4)
gosh> (fringe (list x x))
(1 2 3 4 1 2 3 4)