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

Re: [Scheme-reports] practical matters - CSAN



 | Date: Mon, 29 Aug 2011 12:31:23 -0400
 | From: "Aaron W. Hsu" <arcfide@x>
 | 
 | 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

Converting multiple values to a list is more cumbersome than just
returning a list in the first place.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports