Eval in Haskell
Lauri Alanko
la@iki.fi
Mon, 2 Jun 2003 08:57:26 +0300
[We now have lost all pretence of topicality]
On Sun, Jun 01, 2003 at 08:43:03PM -0700, Ashley Yakeley wrote:
> Guile seems to be a bit "sloppy" in general. I think it just keeps a
> dictionary of symbol bindings and passes it around at runtime.
>
> guile> (eval '(define b 5))
> guile> b
> 5
This particular kind of sloppiness is pretty common in Scheme REPLs:
la:~$ kawa
#|kawa:1|# (eval '(define b 5))
#|kawa:2|# b
5
#|kawa:3|#
la:~$ mzscheme
Welcome to MzScheme version 204, Copyright (c) 1995-2003 PLT
> (eval '(define b 5))
> b
5
>
la:~$ bigloo
------------------------------------------------------------------------------
Bigloo (2.5c) ,--^,
`a practical Scheme compiler' _ ___/ /|/
Wed Nov 27 10:49:16 CET 2002 ,;'( )__, ) '
Manuel Serrano ;; // L__.
email: ' \ / '
Manuel.Serrano@sophia.inria.fr ^ ^
------------------------------------------------------------------------------
Welcome to the interpreter
1:=> (eval '(define b 5))
b
1:=> b
5
1:=>
la:~$ mit-scheme
Scheme Microcode Version 14.9
MIT Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.
Scheme saved on Tuesday June 18, 2002 at 2:26:05 AM
Release 7.7.1
Microcode 14.9
Runtime 15.1
SF 4.40
Liar (Intel i386) 4.115
Edwin 3.112
1 ]=> (eval '(define b 5) system-global-environment)
;Value: b
1 ]=> b
;Value: 5
1 ]=>
End of input stream reached
Happy Happy Joy Joy.
... though admittedly it's a bit confusing, since "define" either binds
or assigns to a variable, depending on whether it was already bound.
Lauri Alanko
la@iki.fi