#define ONE 2

Adam Hinz: The Blog

Continuing with continuations

On 2006-06-24 at 6/24/2006 01:52:00 AM...

[music] The Beatles - Kansas City (Hey Hey Hey Hey)

My Awesome function of the day:
(define until
(lambda (in c k)
(cond
[(null? in) (cons (k '()) '())]
[(equal? (car in) c) (cons (k '()) (cdr in))]
[else (until (cdr in) c (lambda (v) (k (cons (car in) v))))])))

(until '(#\a #\b #\d #\& #\c a b c) #\& (lambda (v) v))
=> ((#\a #\b #\d) #\c a b c)


Hinzy out

1 comments

Other places where I exist


Archive