[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alternative formulations of keywords
Eli Barzilay scripsit:
> (I'll be using the syntax from our library, no time to read Marc's
> syntax, sorry.)
> (define (assoc x l #!key test)
> ... assoc using `test' to find an item ...)
> ;; searches for an x association in foo's table, same keywords as `assoc'
> (define (search x foo . r)
> (apply assoc x (foo-table foo) r))
Ah. But this does not require computed keywords as such; it simply
requires that whatever keywords are mapped into is a proper Scheme
object. Under my #1, the keywords become a list of values and
#!missing's in a fixed order; under my #2, they become an a-list.
In either case, your SEARCH works correctly.
Computed keywords proper require a use case in which, given
(define (foo x &key test) ...)
the call (foo bar baz zam) works iff the value of baz is the symbol TEST.
This might be a Good Thing, but I'd still like a use case.
John Cowan email@example.com http://www.ccil.org/~cowan
Thor Heyerdahl recounts his attempt to prove Rudyard Kipling's theory
that the mongoose first came to India on a raft from Polynesia.
--blurb for Rikki-Kon-Tiki-Tavi