Jonathan Lang wrote:
When you take the square root of a number, you actually get one of two
possible answers (for instance, sqrt(1) actually gives either a 1 or a
-1).

sqrt() is a function that maps its input domain into its output range. As such multiple return values are at least not part of the standard mathematical definition. But in Perl6 a junction is a single value :) What you mean is to solve the equation x**2 == 1 which indeed has got the two Int solutions -1 and 1 or the two Complex ones (1,0) and (-1,0).


IIRC, this is exactly what lazy lists are for.

Essentially lazy lists are suspended closures. But I dought that arithmetic between them is defined such that pi + pi would leazily calculate 6.28...


So what happens when you apply a junction to a lazy list? Do you get a
"lazy junction"?

I think so, by the law of laziness preservation ;) -- TSa (Thomas Sandlaß)



Reply via email to