login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #108 InfiniteTuple and Stream revision 2 of 3

1 2 3
Editor: oldk1331
Time: 2017/07/12 14:20:02 GMT+0
Note: fix the code for FriCAS: 'generate' -> 'stream'

added:
In FriCAS, the function 'generate' has been renamed to 'stream'.


changed:
-primes := generate(nextPrime,2)
primes := stream(nextPrime,2)

changed:
-primes := generate(nextPrime,2)$Stream Integer
primes := stream(nextPrime,2)$Stream Integer

changed:
-primes := construct generate(nextPrime,2)
primes := construct stream(nextPrime,2)

Submitted by : (unknown) at: 2007-11-17T21:52:18-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

Section 5.6 An Example: [Streams]? of Primes

of the Axiom Book says: "This is how you use generate to generate an infinite stream of primes." In FriCAS?, the function generate has been renamed to stream.

fricas
primes := stream(nextPrime,2)

\label{eq1}\left[ 2, \: 3, \: 5, \: 7, \:{11}, \:{13}, \:{17}, \:{19}, \:{2
3}, \:{29}, \:...\right](1)
Type: InfiniteTuple?(Integer)

but the result is an InfiniteTuple?, not a Stream. The domain InfiniteTuple? is not documented in the book.

To create a stream one must explicitly write:

fricas
primes := stream(nextPrime,2)$Stream Integer

\label{eq2}\left[ 2, \: 3, \: 5, \: 7, \:{11}, \:{13}, \:{17}, \:{19}, \:{2
3}, \:{29}, \:...\right](2)
Type: Stream(Integer)

or

fricas
primes := construct stream(nextPrime,2)

\label{eq3}\left[ 2, \: 3, \: 5, \: 7, \:{11}, \:{13}, \:{17}, \:{19}, \:{2
3}, \:{29}, \:...\right](3)
Type: Stream(Integer)