caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] # eval line; (?)
@ 2002-05-09 13:58 Coletta Rémi
  2002-05-09 19:03 ` Warp
  2002-05-09 19:22 ` Sami Mäkelä
  0 siblings, 2 replies; 7+ messages in thread
From: Coletta Rémi @ 2002-05-09 13:58 UTC (permalink / raw)
  To: caml-list

Hello,

# line;;
- : string = "let b = 1;;"

# b;;
  ^
Unbound value b

I'm looking for a function like "eval" in LISP, that does

# eval line;
-: int = 1

#b;;
- : int = 1

Thanks,

-- 
Remi COLETTA
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: [Caml-list] # eval line; (?)
@ 2002-05-10 20:39 Gurr, David (MED, self)
  2002-05-16 20:23 ` Coletta Rémi
  0 siblings, 1 reply; 7+ messages in thread
From: Gurr, David (MED, self) @ 2002-05-10 20:39 UTC (permalink / raw)
  To: Sami Mäkelä, Coletta Rémi; +Cc: caml-list


I think that there is a small catch.  I think that the definition of 
eval is correct, but that if you use it in a toplevel loop, then it
will fail because of the parser not reenterant. -D

> -----Original Message-----
> From: Sami Mäkelä [mailto:sajuma@utu.fi]
> Sent: Thursday, May 09, 2002 12:23 PM
> To: Coletta Rémi
> Cc: caml-list@inria.fr
> Subject: Re: [Caml-list] # eval line; (?)
> 
> 
> > # line;;
> > - : string = "let b = 1;;"
> > 
> > # b;;
> >   ^
> > Unbound value b
> > 
> > I'm looking for a function like "eval" in LISP, that does
> > 
> > # eval line;
> > -: int = 1
> > 
> > #b;;
> > - : int = 1
> 
> Try:
> 
> let eval str =
>   Toploop.execute_phrase true Format.std_formatter
>      (!Toploop.parse_toplevel_phrase (Lexing.from_string str));;
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: 
> http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: 
http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-05-16 20:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-09 13:58 [Caml-list] # eval line; (?) Coletta Rémi
2002-05-09 19:03 ` Warp
2002-05-09 19:22 ` Sami Mäkelä
2002-05-10 18:02   ` Chris Hecker
2002-05-10 19:27     ` Sami Mäkelä
2002-05-10 20:39 Gurr, David (MED, self)
2002-05-16 20:23 ` Coletta Rémi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).