sof
sof

Reputation: 9649

Lazy Racket on REPL

I can change Racket from strict to lazy evaluation using #lang lazy, but that only works in a module. How can I use it in the REPL console?

Upvotes: 0

Views: 119

Answers (1)

Alexis King
Alexis King

Reputation: 43842

To set the language in the REPL, you can use the -I flag. For example, to use the lazy language, run racket -iI lazy:

$ racket -iI lazy
Welcome to Racket v6.7.0.3.
> (define fibs
    (list* 1 1 (map + fibs (cdr fibs))))
> fibs
#<promise:fibs>
> (list-ref fibs 10)
89

Upvotes: 3

Related Questions