[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] What does #!key mean?
From: |
Thomas Chust |
Subject: |
Re: [Chicken-users] What does #!key mean? |
Date: |
Sun, 25 Sep 2005 21:54:03 -0000 |
User-agent: |
Opera M2/8.02 (MacPPC, build 2148) |
Am 25.09.2005, 20:44 Uhr, schrieb Shawn Rutledge
<address@hidden>:
[...]
The "even number of args" requirement is a little odd though. Another
syntax for this kind of functionality would be
(fn (i . 1) (j . 2))
which seems more like typical scheme to me, and you don't need the
special meaning for symbols that end with colon.
[...]
Hello,
the syntax you propose has the disadvantage that you would have to quote
it clumsily like this:
(fn `(i . ,1) `(j . ,2))
or use a construct like
(fn (cons 'i 1) (cons 'j 2))
in order to make it really work.
Well, I admit that in the given simple case you could just use
(fn '(i . 1) (j . 2))
but you cannot do that any longer once the part after the dot is variable.
Nevertheless the keyword magic may not be to everyone's taste -- but if
you don't like it, just don't use it ;) Your syntax can easily be achieved
by using a construct like this:
(define (fn . args)
(let ((i (alist-ref args 'i))
(j (alist-ref args 'j)))
<do something to i and j>))
cu,
Thomas