[plt-scheme] Keyword args
On Oct 21, Alex Peake wrote:
> ;; Scans a Lisp-style keyword/value property list.
> (define (getarg initargs name . not-found)
> (define (scan tail)
> (cond ((null? tail) (if (pair? not-found)
> (car not-found)
> (error 'getarg "couldn't find ~e." name)))
> ((null? (cdr tail)) (error 'getarg "keyword list not balanced ~e." (car tail)))
> ((eq? (car tail) name) (cadr tail))
> (else (scan (cddr tail)))))
> (scan initargs)))
This is from a really old version of Swindle, slightly edited.
Probably used someplace else.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!