Streams and meMoizing are two different things. In a stream you dont want
memoizing (except when the GC decides otherwise) In a stream you want to
avoid unnacesary future computations, but you want to restrict computations
as far as they are necessary. This comment is based on streams implemeneted
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-cons from racket/stream isn't lazy
> 
> 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 as it calculates them. Interface for this is
> a function stream-memoize :: seq -> seq. So
> 
> (let ([s2 (stream-map func s)])
>   (for ([i s2]) ...)
>   (for ([i s2]) ...))
> 
> calculates all values twice (but does not use additional memory), but
> 
> (let ([s2 (stream-memoize (stream-map func s))])
>   (for ([i s2]) ...)
>   (for ([i s2]) ...))
> 
> only calculates values once.
> 
> Eugene
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to