caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Re: Toplevel question ...
@ 2002-03-04 17:10 Harrison, John R
  2002-03-04 18:42 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 3+ messages in thread
From: Harrison, John R @ 2002-03-04 17:10 UTC (permalink / raw)
  To: 'Andrzej M. Ostruszka', Caml List; +Cc: Harrison, John R

Tomasz Zielonka writes:

> > Is there some alias in toplevel for the result of last evaluation so one
> > could use it instead of retyping (there's no history completion :() and
> > binding to some name?

I don't think so, but I also wish there were. Some other implementations
of ML automatically bind the result of the previous evaluation to a
special identifier "it", treating an expression "E" as "let it = E". This
is really useful if, like me, you work in the toplevel a lot and often
want to evaluate ad hoc chains of dependent expressions.

Even if the OCaml developers don't want to add this feature to the
default toplevel, it must be very easy to support using Camlp4. Perhaps
Daniel de Rauglaudre or another expert can tell us how?

John.
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Re: Toplevel question ...
  2002-03-04 17:10 [Caml-list] Re: Toplevel question Harrison, John R
@ 2002-03-04 18:42 ` Daniel de Rauglaudre
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel de Rauglaudre @ 2002-03-04 18:42 UTC (permalink / raw)
  To: Caml List

Hi,

On Mon, Mar 04, 2002 at 09:10:16AM -0800, Harrison, John R wrote:

> Even if the OCaml developers don't want to add this feature to the
> default toplevel, it must be very easy to support using Camlp4. Perhaps
> Daniel de Rauglaudre or another expert can tell us how?

$ cat it.ml
#load "pa_extend.cmo";
#load "q_MLast.cmo";
open Pcaml;
EXTEND
  top_phrase:
    [ [ sti = str_item; ";;" ->
          match sti with
          [ <:str_item< $exp:e$ >> -> Some <:str_item< value it = $e$ >>
          | x -> Some x ] ] ]
  ;
END;

$ ocamlc -pp camlp4r -I +camlp4 -c it.ml

$ ocaml
        Objective Caml version 3.04+6 (2002-02-05)

# #load "camlp4o.cma";;
        Camlp4std Parsing version 3.04+6 (2002-02-05)

# #load "it.cmo";;
# 2 + 2;;
val it : int = 4

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Re: Toplevel question ...
  2002-03-01  9:36 ` Tomasz Zielonka
@ 2002-03-02 10:25   ` Andrzej M. Ostruszka
  0 siblings, 0 replies; 3+ messages in thread
From: Andrzej M. Ostruszka @ 2002-03-02 10:25 UTC (permalink / raw)
  To: Caml List

On Fri, Mar 01 (2002), Tomasz Zielonka wrote:
> > Is there some alias in toplevel for the result of last evaluation so one
> > could use it instead of retyping (there's no history completion :() and
> > binding to some name?
> 
> Lack of history can be easily solved - use ledit:

I'll use this mail as an opportunity to thank to all who suggested me
ledit cause this somewhat improves situation but it is still not what I
wanted :) (I want to avoid recomputing of the result).

If there no solution for it then I'll force myself to think before
typing (which I belive is not that bad policy :)) and bind result if it
can cost much of the cputime.

					Best regards
-- 
    ____   _  ___
   /  | \_/ |/ _ \		Andrzej Marek Ostruszka
  / _ |     | (_) | Instytut Fizyki, Uniwersytet Jagiellonski (Cracow)
 /_/ L|_|V|_|\___/	(PGP <-- finger ostruszk@order.if.uj.edu.pl)
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-04 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-04 17:10 [Caml-list] Re: Toplevel question Harrison, John R
2002-03-04 18:42 ` Daniel de Rauglaudre
  -- strict thread matches above, loose matches on Subject: below --
2002-02-28 15:49 [Caml-list] " Andrzej M. Ostruszka
2002-03-01  9:36 ` Tomasz Zielonka
2002-03-02 10:25   ` [Caml-list] " Andrzej M. Ostruszka

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).