[r6rs-discuss] multiple values and mathematicians
Alan Watson
alan at alan-watson.org
Thu Feb 19 12:51:44 EST 2009
Brad,
While you're right that Brian's suggestion failed in the trivial case
of (values x), I think you can write values and call-with-values in
terms of other primitives given suitable records.
values: If values is called with one argument, return it. Otherwise,
wrap the arguments in a "values record".
call-with-values: If the producer returns a "values record", unwrap it
to obtain the values and call the consumer with them. Otherwise call
the consumer with the value returned by the producer.
Of course, there is no error checking (and also no silent coercion of
multiple values to the single value when the continuation only expects
a single value). I've thought about adding multiple values to Stalin
using exactly this trick.
Now, Brian said that "this feature adds nothing to Scheme's
expressiveness". We can debate expressiveness until the cows come home
(and leave again) and not reach a conclusion. However, I think the
ability to implement multiple values in terms of records means that we
can usefully debate whether they might better be accommodated in a
library rather than the core language.
Regards,
Alan
--
Alan Watson
http://www.alan-watson.org/
More information about the r6rs-discuss
mailing list