call/cc

call/cc の良い unit testを探していたら、結城さんのところで良いのを発見。
g:sicp:id:hyuki:20060506:cont3

(define find (lambda (pred list)
  (call/cc
    (lambda (return)
      (for-each
        (lambda (e) (if (pred e) (return e)))
        list)
      #f))))

(assert-check-true "call/cc"
                    (= (find even? (list 1 2 3 4)) 2)
                    (= (find odd? (list 1 2 3 4)) 1)
)