caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Returning an element computed with Toploop
@ 2012-07-10 15:08 Jean-Baptiste Jeannin
  2012-07-10 20:50 ` Edgar Friendly
  2012-07-11  2:42 ` [Caml-list] " Hongbo Zhang
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Baptiste Jeannin @ 2012-07-10 15:08 UTC (permalink / raw)
  To: caml-list

Hello all,

Thanks to Jonathan Kimmitt on this mailing list, I learned about the existence of the Toploop module, that allows to execute OCaml code from a string. For example, one can do:

# Toploop.execute_phrase true Format.err_formatter
((!Toploop.parse_toplevel_phrase) (Lexing.from_string "355./.113.;;"));;
- : float = 3.14159292035398252
- : bool = true

However I could not find any official documentation of the module on the internet. In particular, the example above only prints out what was computed and returns a boolean (true or false), depending on how the computation terminated. I would like to compute an element and get the element back to be able to use it later in the computation. Is that possible and how could I do it?

Thanks a lot,
Jean-Baptiste

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

end of thread, other threads:[~2012-07-11  2:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 15:08 [Caml-list] Returning an element computed with Toploop Jean-Baptiste Jeannin
2012-07-10 20:50 ` Edgar Friendly
2012-07-11  2:42 ` [Caml-list] " Hongbo Zhang

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).