The adapter submodule does not work, I get the following error (in both
typed and untyped Racket):
fib.rkt:9:0: module: no #%module-begin binding in the module's language
in: (module adapter racket/stream (provide stream-first stream-rest
(rename-out (stream-cons* stream-cons))) (define (stream-cons* make-first
make-rest/seq) (stream-cons (make-first) (sequence->stream
If I understand your code correctly, the idea is to define `fibonacci` as a
stream which returns a stream of Fibonacci numbers, correct? Won't that
incur a performance loss when used like that in a for-loop if the user does
not wrap it up in `in-stream`? The idea of `in-fibonacci` was to have a
form which can be used in a foor-loop the same way `in-naturals` can be.
Except `in-fibonacci` would have an optional argument at which Fibonacci
number to start counting.
On Sunday, April 22, 2018 at 10:48:12 AM UTC+2, Philip McGrath wrote:
> I hope there's a better way, but this works. The adapter submodule is
> needed because the normal `stream-cons` is a macro that expands into some
> private things that don't have types, and it requires that the rest
> expression produce a stream, not just any sequence. Note also, if you
> haven't worked with `racket/stream` before, that the arguments to the
> normal `stream-cons` are evaluated lazily.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.