Re: [Scheme-reports] practical matters - CSAN
Aubrey Jaffer 07 Sep 2011 00:18 UTC
| Date: Mon, 29 Aug 2011 12:31:23 -0400
| From: "Aaron W. Hsu" <arcfide@sacrideo.us>
|
| On Mon, 29 Aug 2011 12:16:40 -0400, Aubrey Jaffer <agj@alum.mit.edu> 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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports