caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Baptiste Jeannin <jeannin@cs.cornell.edu>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Returning an element computed with Toploop
Date: Tue, 10 Jul 2012 11:08:36 -0400	[thread overview]
Message-ID: <A7FC6DE86AF33142A1FA4CE04EEBF4F18591C61822@gobo.cs.cornell.edu> (raw)

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

             reply	other threads:[~2012-07-10 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 15:08 Jean-Baptiste Jeannin [this message]
2012-07-10 20:50 ` Edgar Friendly
2012-07-11  2:42 ` [Caml-list] " Hongbo Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A7FC6DE86AF33142A1FA4CE04EEBF4F18591C61822@gobo.cs.cornell.edu \
    --to=jeannin@cs.cornell.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).