|
Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(16 Mar 2020 13:09 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 13:45 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(16 Mar 2020 13:54 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 13:58 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Feeley
(16 Mar 2020 15:38 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(16 Mar 2020 16:00 UTC)
|
|
Re: Self-evaluating keywords or not?
Per Bothner
(16 Mar 2020 16:47 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(16 Mar 2020 16:53 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 20:27 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(16 Mar 2020 20:37 UTC)
|
|
Re: Self-evaluating keywords or not?
Lassi Kortela
(16 Mar 2020 21:17 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(16 Mar 2020 21:31 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 22:05 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(17 Mar 2020 07:14 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(17 Mar 2020 07:46 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(17 Mar 2020 08:05 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(17 Mar 2020 08:31 UTC)
|
|
Re: Self-evaluating keywords or not?
Lassi Kortela
(16 Mar 2020 22:18 UTC)
|
|
Re: Self-evaluating keywords or not?
Per Bothner
(16 Mar 2020 22:36 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 22:42 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(17 Mar 2020 07:22 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 21:34 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 21:43 UTC)
|
|
Re: Self-evaluating keywords or not?
Lassi Kortela
(16 Mar 2020 22:02 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 22:06 UTC)
|
|
Re: Self-evaluating keywords or not?
Shiro Kawai
(16 Mar 2020 22:19 UTC)
|
|
Re: Self-evaluating keywords or not?
Lassi Kortela
(16 Mar 2020 22:24 UTC)
|
|
Re: Self-evaluating keywords or not?
Marc Nieper-Wißkirchen
(17 Mar 2020 07:28 UTC)
|
|
Re: Self-evaluating keywords or not?
Per Bothner
(16 Mar 2020 22:24 UTC)
|
|
Re: Self-evaluating keywords or not? Lassi Kortela (16 Mar 2020 22:56 UTC)
|
|
Re: Self-evaluating keywords or not?
Per Bothner
(17 Mar 2020 00:36 UTC)
|
> 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))
> Regular apply suffixes.
Thanks. Using a special arglist object seems much nicer than the
keyword-apply approach.
Here's some actual code I wrote making use of keyword-apply:
;; Usage: (cache-http cache-name url [keyword-args])
;; Any keyword-args are passed to http-sendrecv/url.
(define cache-http
(make-keyword-procedure
(lambda (kw-syms kw-args cache-name url)
(let (...)
...
(let-values
(((status headers input)
(keyword-apply http-sendrecv/url kw-syms kw-args (list url))))
...)))))
There are several problems with this:
- Had to use `make-keyword-procedure` instead of ordinary `define` or
`lambda`.
- Had to write a comment explaining the "real" argument list accepted by
the procedure.
- Had to use keyword-apply instead of apply (177 also has this problem).
- kw-syms and kw-args are separate lists - would arguably be neater if
it was a single collection.
allow-other-keys/splicing would express this much more nicely.
Does Kawa have allow-other-keys in the lambda-list in some form? I
perused <https://www.gnu.org/software/kawa/Extended-formals.html> but
didn't catch syntax for it.
<https://www.gnu.org/software/kawa/Application-and-Arguments-Lists.html>
is about the other side (caller) as far as I can tell.