guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keyword arguments and #:rest


From: Ludovic Courtès
Subject: Re: keyword arguments and #:rest
Date: Sat, 10 Nov 2012 22:46:47 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Hi,

Panicz Maciej Godek <address@hidden> skribis:

> So I thought that maybe there could be another keyword controlling whether
> the keywords are left in the rest list or not, so the above code could
> look like this:
>
> (define* (random-array #:key (range 1.0) (type #t) (mean 0) #:rest
> dims #:no-key)
>   (array-map (lambda (mean) (+ mean (- (random (* 2 range)) range)))
>               (apply make-typed-array type mean dims)))
>
> Wouldn't the world be a better place?

Perhaps, although that would make the ‘lambda*’ semantics yet more complex.

However, in your example, what about using a list instead of a rest
argument for ‘dims’?

Thanks,
Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]