[racket] Making a Racket function "recallable"
On Tue, Feb 14, 2012 at 12:32 AM, Joe Gilray <jgilray at gmail.com> wrote:
> Danny,
>
> Thanks for the explanations. These are powerful ideas. It appears not to
> generate the sequence until needed, very nice.
>
> How could I modify this to do the "less than n" idea?
A stream is a sequence, and also has a few more functions that act
very much like the familiar list-oriented functions.
http://docs.racket-lang.org/reference/streams.html#(tech._stream)
So you could use stream-first and stream-rest on the fib-stream, as if
you had entire fibonacci sequence in front of you as an infinite list.
Just don't try to stream->list it.