Re: The name of "keyword-call"
Marc Nieper-Wißkirchen 23 Oct 2019 06:00 UTC
Am Di., 22. Okt. 2019 um 21:56 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
>
> How about one of these:
>
> ----------------------------------------------------------------------
>
> (define foo
> (kwlambda (a b (c d e))
> (list a b c d e)))
>
> (foo 1 2) ; => (1 2 #f #f #f)
> (apply foo 1 2 '()) ; => (1 2 #f #f #f)
> (kwcall foo 1 2 ()) ; => (1 2 #f #f #f)
> (kwcall foo 1 2 (d 4)) ; => (1 2 #f 4 #f)
> (kwcall foo 1 2 (d 4 e 5)) ; => (1 2 #f 4 5)
> (kwcall foo 1 2 (e 5 c 3 d 4)) ; => (1 2 3 4 5)
>
> ----------------------------------------------------------------------
>
> (define foo
> (klambda (a b (c d e))
> (list a b c d e)))
>
> (foo 1 2) ; => (1 2 #f #f #f)
> (apply foo 1 2 '()) ; => (1 2 #f #f #f)
> (kcall foo 1 2 ()) ; => (1 2 #f #f #f)
> (kcall foo 1 2 (d 4)) ; => (1 2 #f 4 #f)
> (kcall foo 1 2 (d 4 e 5)) ; => (1 2 #f 4 5)
> (kcall foo 1 2 (e 5 c 3 d 4)) ; => (1 2 3 4 5)
>
> ----------------------------------------------------------------------
>
> I intended 177 as a stopgap measure (though one that will admittedly
> last for years). Ideally the language would have read syntax so you
> could just type keywords into ordinary function calls and lambda lists
> (as you can already do in a few Schemes).
>
> The name "kcall" is as short as "apply". Should it be even shorter?
What about overloading "apply"? In other words, "apply" would become
the universal method to call procedures with a variable number of
arguments (positional and keyword arguments).
I find this idea intriguing. Implementing this may need identifier
syntax, though, so that the procedure "apply" can be overloaded with a
macro "apply".
Marc