axiom-developer
[Top][All Lists]

## [Axiom-developer] [#90 coredump with infinite stream]

 From: anonymous Subject: [Axiom-developer] [#90 coredump with infinite stream] Date: Wed, 09 Feb 2005 05:25:46 -0600

--removed:
-From TimDaly Tue Feb 8 05:44:17 -0600 2005
-From: Tim Daly
-Date: Tue, 08 Feb 2005 05:44:17 -0600
-

Tim

This is likely due to stack overflow (previously reported). The construct for
smallerThan require Axiom to test EVERY element in the stream to see if s < n.
There is no reason why Axiom should complain. Axiom is not designed to be able
to figure out a general formula for the nth entry of the output stream for
smallerThan whose signature is:
smallerThan: (Stream Integer, PositiveInteger)->Stream Integer

To do what you are trying to do, try this:

\begin{axiom}
primes:Stream Integer := generate(nextPrime, 2)
lessThan(stream, n) == filterWhile(s+->s<n, stream)
lessThan(primes, 5)
\end{axiom}

However, why should this give an error?
\begin{axiom}
entries primes
\end{axiom}

The expected result would be the first 11 (default stream length) entries.

--