Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Sami Mäkelä" <sajuma@utu.fi>
To: "Coletta Rémi" <remi.coletta@free.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] # eval line; (?)
Date: Thu, 09 May 2002 22:22:43 +0300	[thread overview]
Message-ID: <3CDACC83.563B15A1@utu.fi> (raw)
In-Reply-To: <20020509155828.4015de6d.remi.coletta@free.fr>

> # 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


  parent reply	other threads:[~2002-05-09 19:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-09 13:58 Coletta Rémi
2002-05-09 19:03 ` Warp
2002-05-09 19:22 ` Sami Mäkelä [this message]
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

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=3CDACC83.563B15A1@utu.fi \
    --to=sajuma@utu.fi \
    --cc=caml-list@inria.fr \
    --cc=remi.coletta@free.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