caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: paul.lachat@edu.univ-fcomte.fr
To: "Sébastien Hinderer" <Sebastien.Hinderer@inria.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] [Question] Loading .ml in memory to interact with them.
Date: Thu, 23 Mar 2017 14:57:42 +0100 (CET)	[thread overview]
Message-ID: <1474510167.9307838.1490277462820.JavaMail.zimbra@edu.univ-fcomte.fr> (raw)
In-Reply-To: <20170323134121.cuclsd52clhmra3z@pema>

I've tried :

In one shell :
ocaml < /tmp/pipe_in > /tmp/pipe_out

In another shell :

tail -f /tmp/pipe_out &

cat << EOF > /tmp/pipe_in
heredoc> 1+1;;
heredoc> let x = 10;;
heredoc> let y = 15;;
heredoc> x;;
heredoc> y;;
heredoc> EOF

(feedback of tail)

        OCaml version 4.03.0                                                 

# - : int = 2
# val x : int = 10
# val y : int = 15
# - : int = 10
# - : int = 15
# 

____

But that's not what I want.
I want to be able to have this kind of logic :

1- Launch the ocaml toplevel.

2- The toplevel wait an instruction.

3- Send one instruction.

4- Get the result of the instruction.

5- Go back to 2- until we send "#quit;;".

I know that when you type ctrl-d in the toplevel it stop.
And that ctrl-d is the end-of-file 'keystroke'.

But I would like, if possible, to have a persistant tolevel process running.
So when I load a file via the #use ".ml";; directive, I can after that, and at any time,
call function of the .ml and get the result display by the toplevel.

It would be better than always re-read the file to get the result of a function (for example).

  reply	other threads:[~2017-03-23 13:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23  9:37 paul.lachat
2017-03-23 13:02 ` Sébastien Hinderer
2017-03-23 13:26   ` paul.lachat
2017-03-23 13:41     ` Sébastien Hinderer
2017-03-23 13:57       ` paul.lachat [this message]
2017-03-23 14:24 ` Evgeny Roubinchtein
2017-03-23 15:09 ` François Bobot
     [not found]   ` <CAGYXaSbcqNWcXe1MLm_YyS28N7ji3td=L_jFVv35=50oSxaUDQ@mail.gmail.com>
2017-03-23 15:50     ` François Bobot
2017-03-24  9:04 ` Kim Nguyễn
2017-03-24 14:43 Oleg

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=1474510167.9307838.1490277462820.JavaMail.zimbra@edu.univ-fcomte.fr \
    --to=paul.lachat@edu.univ-fcomte.fr \
    --cc=Sebastien.Hinderer@inria.fr \
    --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).