Re: Script to create a "restart" directive in toplevel
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
> while true; do echo '---bouncer! will have to add make -----' && rlwrap ocaml; done > Hope this helps. It does help! In fact, it seems to work fine. Many thanks. ---In [email protected], <misterherr@...> wrote : On 06.09.2015 11:26, doylejonathan58@... mailto:doylejonathan58@... [ocaml_beginners] wrote: > When I build projects with ocaml I use the toplevel a lot, > and it would make my life much easier if I had a way to compile > the following sequence of commands in a unique > unit->unit function (say ): > > #quit;; (* leave current toplevel *) > make (* recompile *) > ./ocaml (* enter newly compiled toplevel *) > > > I have incomplete ideas about how to achieve this. For the > middle command I obviously can use Sys.command "make";;, > and I think I must somehow change the order of the commands > (the old toplevel executable must somehow "leave a message" > indicating to launch the new toplevel before self-destructing). > > Any help appreciated. I would do the compile and test cycle at the shell level. Proof of concept: # if you terminate the toplevel with Ctrl+d, it will be restarted, Ctrl+c stops the loop: while true; do echo '---bouncer! will have to add make -----' && rlwrap ocaml; done Hope this helps. /Str.