caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dave Benjamin <dave@ramenlabs.com>
To: Roland Zumkeller <roland.zumkeller@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Toploop.setvalue
Date: Thu, 12 Mar 2009 21:53:59 -0700	[thread overview]
Message-ID: <49B9E6E7.5040109@ramenlabs.com> (raw)
In-Reply-To: <d02dcb040903081443w7cecf435kdfaf4881a8b2994c@mail.gmail.com>

Roland Zumkeller wrote:
> Hi,
> 
> Can Toploop.setvalue be used to bind a value to an identifier, as does "let"?
> 
> # Toploop.setvalue "b" (Obj.repr 43);;
> - : unit = ()
> # b;;
> Unbound value b
> 
> I only got the other direction to work:
> 
> # let a = 42;;
> val a : int = 42
> # (Obj.obj (Toploop.getvalue "a") : int);;
> - : int = 42

Not that I know of. I was only able to get it to rebind values that I 
initialized by evaluating expressions like "let b = 43;;". Here's an 
example:

http://pleac.sourceforge.net/pleac_ocaml/strings.html#AEN68

Hope this helps - and if anyone has better advice I'd love to hear it,
Dave


  reply	other threads:[~2009-03-13  4:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-08 21:43 Toploop.setvalue Roland Zumkeller
2009-03-13  4:53 ` Dave Benjamin [this message]
2009-03-13 15:22 ` Toploop.setvalue Zheng Li

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=49B9E6E7.5040109@ramenlabs.com \
    --to=dave@ramenlabs.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=roland.zumkeller@gmail.com \
    /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).