[racket] lazy racket
Thanks for the input.
I tried with Lazy Racket in the language menu instead of #lang, but it does not really do what I want (ie. Haskell).
Actually, apart from the fact that things are printed differently, the result is quite the same:
> ones
(cons 1 (delay ...))
;; ! is not enough
> (! ones)
(cons 1 (delay ...))
> (!! ones)
(shared ((-0- (cons 1 -0-))) -0-)
-- Éric
On Nov 14, 2011, at 6:12 PM, Stephen Chang wrote:
> The problem is that only applications are wrapped with the
> toplevel-forcer. (And you don't actually need !!. Just the regular !
> should be sufficient.)
>
> For a short term solution, if you select Lazy Racket in the language
> menu instead of #lang lazy, it will do what you want, due to a
> subtlety in the way languages are implemented. Lazy Racket when
> selected in the menu is implemented as a "tool", so top level
> variables are wrapped with #%top, which gets forced. #lang languages
> are module languages and module level variables have no such wrapping.
>
> ps racket-dev, should the #%top from lazy racket be removed?
>
>
>
>
> On Mon, Nov 14, 2011 at 2:53 PM, Eric Tanter <etanter at dcc.uchile.cl> wrote:
>> Hi,
>>
>> I'd like to tweak Lazy Racket such that the top-level interactions in the REPL always use `!!' (recursive force), in order to mimic Haskell's behavior as close as possible.
>>
>> If someone can help me in the very brief term, I would really appreciate it (I plan to start teaching on laziness using Lazy Racket tomorrow).
>>
>> Thanks in advance!
>>
>> -- Éric
>>
>> PS: Eli told me of some parameter that controls this behavior. I think it is `toplevel-forcer', but a) I'm not sure, b) even if I hack it manually (edit lazy.rkt), it does not work:
>>
>> ;; parameter is properly set to `!!'
>>> (toplevel-forcer)
>> #<procedure:!!>
>>
>>> ones
>> #<promise:ones>
>>
>>> (!! ones)
>> #0='(1 . #0#)
>>
>> I'd like the following behavior:
>>> ones
>> #0='(1 . #0#)
>> _________________________________________________
>> For list-related administrative tasks:
>> http://lists.racket-lang.org/listinfo/users
>>
>