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

Re: [Scheme-reports] practical matters - CSAN

On Mon, 29 Aug 2011 12:16:40 -0400, Aubrey Jaffer <agj@x> wrote:

> This would seem like a good application for multiple-value returns:
> SCANF-READ would return the number of format directives matched
> followed by the objects read.  But LET-VALUES, LET*-VALUES, and
> (srfi-8) RECEIVE expect the number of bindings to match the number of
> return values.  They can't be used if the number of return values is
> not known in advance.

This does not hold for the normal implementations of LET-VALUES or  
LET*-VALUES. In both cases, if you do not know how many bindings you will  
receive, you can do the following:

(let-values ([x (values 1 2 3)])
   (length x))
; => 3

	Aaron W. Hsu

Programming is just another word for the lost Art of Thinking.

Scheme-reports mailing list