[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Scheme-reports] Values and tuples
- To: scheme-reports@x
- Subject: [Scheme-reports] Values and tuples
- From: Hans Aberg <haberg-1@x>
- Date: Fri, 27 May 2011 19:11:23 +0200
When writing on a parser with normal infix syntax, I found that treating tuples as reifications of values convenient. However, implementing this in a systematic way is very inefficient it seems, as all calls must be passed through call-with-values. Would having this extension risk inefficient Scheme implementations?
Roughly, a normal infix expression f(x_1, ..., x_k) corresponds to Scheme syntax (f x_1 ... x_k), where (x_1, ..., x_k) is a data type satisfying a singleton reduction rule (x) = x. If writing (f (values x_1 ... x_k)) the result would be the same as (call-with-values (lambda () (values x_1 ... x_k)) f), so call-with-values would not be necessary here. If returning (values x_1 ... x_k) in a position where the standard now says the result is unspecified, one would get a singleton reduced tuple (x_1, ..., x_k).
Scheme-reports mailing list