newbie on streams

12 views
Skip to first unread message

ebmtra...@gmail.com

unread,
Apr 23, 2013, 5:05:50 PM4/23/13
to pure...@googlegroups.com
Hi list,
I'm a new pure user and I already have one question about streams and interactive mode.

Suppose a stream of one's is created:
> let ones = [1 | i=1..inf] &;

Then use some of them:
> list $ take 3 ones;
[1,1,1]

Finally, inspect the current state about that stream:
> show ones
let ones = 1:1:1:#<thunk 0xb55ad578>;

All is allright. Now, suppose I want to create my stream like this:
> let ones = 1 : ones &;

I still can use it:
> list $ take 3 ones;
[1,1,1]

but now, I can't inspect it:
> show ones
terminate called after throwing an instance of 'St9bad_alloc'
  what():  std::bad_alloc
Abandon (core dumped)

Is it a bug or is it intrinsicly unsafe to define a stream this way ?




Reply all
Reply to author
Forward
0 new messages