Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-06 Thread Jos Koot
within an eager language. jOS > -Original Message- > From: users-boun...@racket-lang.org > [mailto:users-boun...@racket-lang.org] On Behalf Of Eugene Toder > Sent: 06 March 2011 20:47 > To: Eli Barzilay > Cc: users@racket-lang.org > Subject: Re: [racket] stream-co

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-06 Thread Eugene Toder
To clarify the last point. Say each seq has a method to create an equivalent memoized seq, or return itself if memoization is not needed (e.g. in-range). Memoized seq returns a memoizing iterator, that first goes over previously calculated values, then starts storing newly calculated values in seq

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-06 Thread Eugene Toder
> Either way, it clarifies how to deal with the state.  (Which is why > I'm surprised that the point didn't come up so far.) Right, so we have stateless seqs that are only used to create statefull producer of their values (iterators). For and any other iteration construct ask for iterator and use

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-06 Thread Eli Barzilay
Two minutes ago, Matthias Felleisen wrote: > > On Mar 5, 2011, at 10:32 PM, Eli Barzilay wrote: > > > So you shouldn't use it at all. > > Eli, this remark suggests that 'stream' is mis-documented I think that a comment at the top of the documentation is what was missing. > and that it should

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-06 Thread Matthias Felleisen
On Mar 5, 2011, at 10:32 PM, Eli Barzilay wrote: > So you shouldn't use it at all. Eli, this remark suggests that 'stream' is mis-documented and that it should be moved somewhere else for the next release, before it does more harm (a /private/) -- Matthias __

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Eli Barzilay
An hour and a half ago, Eugene Toder wrote: > > (That's something to know to do the code splitting that Matthias > > is talking about.) > Going back to this, I often find that I want to use laziness as an > interface. That is, I build a system as a collection of components, > written in a strict la

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Eugene Toder
> So you shouldn't use it at all. I wouldn't if I saw any hints :) > The way the lazy language works, any function that is defined outside > of the lazy world (and is not a struct constructor) is considered > eager, so arguments that are sent to it are forced Yes, that's pretty clear. >  (That's

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Eli Barzilay
5 hours ago, Matthias Felleisen wrote: > > I am interested in the following question: does it make sense to > write parts of a systems in Lazy (so that you have lists=streams and > you naturally stay in this world) and yet by linking to the strict > world, you still get the best of both. Four hou

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Eugene Toder
Mark, I'm getting a similar impression. The only problem with this is that racket/stream is available in racket by default and nothing in documentation hints at experimental status. This confuses people who use racket to learn scheme by working through SICP book. Eugene On Sat, Mar 5, 2011 at 7:

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Phil Bewig
You should use SRFI-41, as SRFI-40 is deprecated. On Sat, Mar 5, 2011 at 6:31 PM, Mark Engelberg wrote: > I've had some email discussions about this with the Racket team in the > past, so here's a quick unofficial summary of what I've learned, while > you're waiting for a more official response:

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Mark Engelberg
I've had some email discussions about this with the Racket team in the past, so here's a quick unofficial summary of what I've learned, while you're waiting for a more official response: racket/stream is not really a "stream library" by the typical Scheme definition of stream. It's really a libra

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Eugene Toder
I see how this can make sense, however I'm not sure how to make it work. For example: > (define (foo) (display "called\n") empty-stream) > (cons 1 (foo)) '(1 . #) > (stream-cons 1 (foo)) called # So stream-cons is strict even in lazy racket, perhaps because stream-cons is defined in strict racket

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Matthias Felleisen
On Mar 5, 2011, at 5:18 PM, Eugene Toder wrote: > I though that the whole point of streams was to provide lazy lists in > a strict language. I understand. I am interested in the following question: does it make sense to write parts of a systems in Lazy (so that you have lists=streams and you

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Eugene Toder
Matthias, Is there a reason to use streams in lazy racket? Won't lists give me the same behaviour? > (define (foo) (display "called\n") '()) > (cons 1 (foo)) '(1 . #) I though that the whole point of streams was to provide lazy lists in a strict language. Eugene On Sat, Mar 5, 2011 at 5:11 PM,

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Matthias Felleisen
Consider using Lazy Racket. -- Matthias On Mar 5, 2011, at 3:36 PM, Eugene Toder wrote: > Hello, > > stream-cons from racket's standard racket/stream.rkt is implemented as > a macro -stream-cons wrapped into a case-lambda. > This wrapping makes it strict in both arguments, contrary to the > t

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Jos Koot
+1, this behaviour of stream-cons of racket/stream definitely is wrong. Jos > -Original Message- > From: users-boun...@racket-lang.org > [mailto:users-boun...@racket-lang.org] On Behalf Of Eugene Toder > Sent: 05 March 2011 21:37 > To: users@racket-lang.org > Subject: [racket] stream-cons