Re: Self-evaluating keywords or not?
Per Bothner 16 Mar 2020 22:24 UTC
On 3/16/20 3:02 PM, Lassi Kortela wrote:
>> Kawa's model to distinguish "bare" keyword and quoted one is interesting. Is there a way to pass argument list,
>> including keyword arguments, via apply?
Yes - see https://www.gnu.org/software/kawa/Application-and-Arguments-Lists.html
The basic idea is you can create "arglist" or an "argvector" which is a kind of list
or vector, except the keywords are "marked". You can then pass this arglist
or argvector to apply.
You can also use "slice" syntax, which is more flexible:
(fun @arglist) === (apply fun arglist)
You can combine arglists:
(define xargs (arglist 1 2 key: 3))
(apply fun (arglist 9 8 @xargs))
> In Racket, which shares the Kawa semantics, there is a special `keyword-apply`: "Like apply, but kw-lst and kw-val-lst supply by-keyword arguments in addition to the by-position arguments of the vs and lst". So it takes a list of keyword objects and internally converts them somehow to the native calling convention.
>
> <https://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._keyword-apply%29%29>
>
> I couldn't find a similar one in the Kawa manual with a quick search.
Regular apply suffixes.
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/