Jörg F. Wittenberger scripsit: > Rather uncontroversial: r7rs says "the result of a delayed > expression returning multiple values is unspecified". Hence it's OK > to actually return multiple values (as I'd prefer r7rs should have > explicitely required). The downside is that a portable program must > not depend on this to work.
The reason we didn't require this is that in order to cache the multiple values, in practice the implementation would have to put them into a data structure, so the user might just as well delay the data structure explicitly. So instead of (delay (exact-integer-sqrt n)), you can instead do (delay (call-with-values (lambda () (exact-integer-sqrt n)) list). This may be a bit more messy, but it didn't seem worth complicating the implementation for what is expected to be a rare case. > It specifies "if it is forced a second time, the previously computed > value is returned". This _could_ (and IMHO _should_) be understood > as if the delayed expression must only ever be evaluated once. That's the most plausible interpretation, yes. But there are at least two issues: re-entrancy via call/cc and via threads (which in some implementations may be the same). We left that open, because it's not clear what the Right Thing is. -- John Cowan co...@ccil.org http://ccil.org/~cowan The penguin geeks is happy / As under the waves they lark The closed-source geeks ain't happy / They sad cause they in the dark But geeks in the dark is lucky / They in for a worser treat One day when the Borg go belly-up / Guess who wind up on the street. _______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers