[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (ice-9 optargs) #:rest args polluted?
From: |
Thien-Thi Nguyen |
Subject: |
Re: (ice-9 optargs) #:rest args polluted? |
Date: |
Wed, 14 Nov 2001 11:05:26 -0800 |
From: Marius Vollmer <address@hidden>
Date: 13 Nov 2001 00:34:11 +0100
The behavior of Guile mirrors that of Common Lisp here, so I think we
should keep it. Together with :allow-other-keys, you need :rest to
get at the other keys; and without :allow-other-keys, :rest makes not
much sense, I'd say.
so what's the idiom to isolate the non-keys rest-args? i can't believe
everyone is writing `remove-keys' (like me!)...
(define* (blah #:key (j 'j) (k 'k) #:rest x)
(set! x (remove-keys x))
(write-line (list blah j k x)))
thi
________________________________________
(define (remove-keys ls)
(let loop ((ls ls) (acc '()))
(if (null? ls)
(reverse acc)
(let ((kw? (keyword? (car ls))))
(loop ((if kw? cddr cdr) ls)
(if kw? acc (cons (car ls) acc)))))))