LispInSmallPieces/racket/chap3.rkt

11 lines
246 B
Racket
Raw Permalink Normal View History

2015-05-14 05:23:30 +00:00
(define (find-symbol id tree)
(call/cc
(lambda (exit)
(define (find tree)
(if (pair? tree)
(or (find (car tree)) (find (cdr tree)))
(if (eq? tree id) (exit #t) #f)))
(find tree))))