public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Using APPLY with functions with #!key arguments
@ 2017-12-28  1:29 Duncan Mak
  2017-12-28  2:49 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Duncan Mak @ 2017-12-28  1:29 UTC (permalink / raw)
  To: kawa mailing list

I think this used to work in older Kawa releases, but how do I use
APPLY to invoke a function like this in Kawa 3.0?

#|kawa:1|# (define (foo x #!key y) (list x y))

#|kawa:2|# (foo 1 y: 2)
(1 2)

#|kawa:3|# (apply foo (list 1))
(1 #f)

#|kawa:4|# (apply foo (list 1 2))
gnu.mapping.WrongArguments

#|kawa:5|# (apply foo (list 1 y: 2))
gnu.mapping.WrongArguments

In Kawa 2.4, this worked:

duncan@furigana:~/Downloads/kawa-2.4/bin$ ./kawa
#|kawa:1|# (define (foo x #!key y) (list x y))
#|kawa:2|# (apply foo (list 1 y: 2))
(1 2)
#|kawa:3|# (apply foo (list 1 2))
(1 #f)


Happy holidays!


-- 
Duncan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using APPLY with functions with #!key arguments
  2017-12-28  1:29 Using APPLY with functions with #!key arguments Duncan Mak
@ 2017-12-28  2:49 ` Per Bothner
  2017-12-28  3:57   ` Duncan Mak
  0 siblings, 1 reply; 3+ messages in thread
From: Per Bothner @ 2017-12-28  2:49 UTC (permalink / raw)
  To: Duncan Mak, kawa mailing list

On 12/27/2017 05:28 PM, Duncan Mak wrote:
> I think this used to work in older Kawa releases, but how do I use
> APPLY to invoke a function like this in Kawa 3.0?
> 
> #|kawa:1|# (define (foo x #!key y) (list x y))

You can do this:

(apply foo (arglist 1 y: 2))

which is the same as:

(foo @:(arglist 1 y: 2))

This chapter in the manual should be helpful:
https://www.gnu.org/software/kawa/Application-and-Arguments-Lists.html

-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using APPLY with functions with #!key arguments
  2017-12-28  2:49 ` Per Bothner
@ 2017-12-28  3:57   ` Duncan Mak
  0 siblings, 0 replies; 3+ messages in thread
From: Duncan Mak @ 2017-12-28  3:57 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

Thanks Per! That worked!

On Wed, Dec 27, 2017 at 9:48 PM, Per Bothner <per@bothner.com> wrote:
> On 12/27/2017 05:28 PM, Duncan Mak wrote:
>>
>> I think this used to work in older Kawa releases, but how do I use
>> APPLY to invoke a function like this in Kawa 3.0?
>>
>> #|kawa:1|# (define (foo x #!key y) (list x y))
>
>
> You can do this:
>
> (apply foo (arglist 1 y: 2))
>
> which is the same as:
>
> (foo @:(arglist 1 y: 2))
>
> This chapter in the manual should be helpful:
> https://www.gnu.org/software/kawa/Application-and-Arguments-Lists.html
>
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/



-- 
Duncan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-28  3:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-28  1:29 Using APPLY with functions with #!key arguments Duncan Mak
2017-12-28  2:49 ` Per Bothner
2017-12-28  3:57   ` Duncan Mak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).