[Top][All Lists]

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

Re: keyword arguments and #:rest

From: Panicz Maciej Godek
Subject: Re: keyword arguments and #:rest
Date: Mon, 12 Nov 2012 11:19:49 +0100


2012/11/10 Ludovic Courtès <address@hidden>:
> Hi,
>> 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.

That's true, but it's only in regard that is already mentioned in the
documentation (and has to be, if we want to avoid confusion). So I
think that in a way this would be a natural extension

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

That would also be a solution, but the way it is done now inherits the
interface from make-typed-array, which is one thing less to memoize

Best regards,

reply via email to

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