caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] how to use a module
@ 2003-06-30 20:11 Jean-Baptiste Rouquier
  2003-07-01  1:49 ` Matt Gushee
  0 siblings, 1 reply; 9+ messages in thread
From: Jean-Baptiste Rouquier @ 2003-06-30 20:11 UTC (permalink / raw)
  To: caml-list

>I'm having trouble (using the modules or the files that I wrote)   (in the
interactive mode of  OCaml).


(*First, let Caml know where you put your files if they aren't in the
current directory :*)
#directory "foo/bar";;

(*This is the "include" directive (see the manual) :*)
#use "baz.ml";;

(*if you file is already compiled, you can use :*)
#load "qux.cmo";;

(*but you have to "#load" all the files that egg uses, for instance if
egg.ml contains "Graphics.open_graph", then you must load graphics before
(as when you link the main programm) :*)
#load "graphics.cma";;
#load "egg.cmo";;

(*If you want to state "quz ()" instead of "Egg.quz ()", just open this
module (it requires egg.cmi in the list of searching directories) :*)
open Egg;;

JB


-------------------
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] 9+ messages in thread

* Re: [Caml-list] how to use a module
  2003-06-30 20:11 [Caml-list] how to use a module Jean-Baptiste Rouquier
@ 2003-07-01  1:49 ` Matt Gushee
  2003-07-01 10:32   ` Remi Vanicat
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Gushee @ 2003-07-01  1:49 UTC (permalink / raw)
  To: caml-list

On Mon, Jun 30, 2003 at 10:11:54PM +0200, Jean-Baptiste Rouquier wrote:
> 
> (*if you file is already compiled, you can use :*)
> #load "qux.cmo";;

If you know in advance what you want to load, you can also load it by
passing it as an argument to the toplevel, e.g.:

  $ ocaml qux.cmo

I prefer this approach because it cuts down on the characters I have to
retype when I make errors (Note to OCaml team: can we *please* get some
kind of history-editing functionality in the toplevel? I know there are
licensing and portability issues with GNU readline, but what about the
getline library used by OCaml2?)

This approach is also handy if you want to quickly check your syntax:

  $ ocaml my_new_module.ml

This doesn't give you an interactive shell, so it's different from
  
  $ ocaml
  # #use "my_new_module.ml";;

But it will tell you if there are errors in your code.

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
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] 9+ messages in thread

* Re: [Caml-list] how to use a module
  2003-07-01  1:49 ` Matt Gushee
@ 2003-07-01 10:32   ` Remi Vanicat
  2003-07-01 18:29     ` Ledit (was Re: [Caml-list] how to use a module) Matt Gushee
  0 siblings, 1 reply; 9+ messages in thread
From: Remi Vanicat @ 2003-07-01 10:32 UTC (permalink / raw)
  To: caml-list

Matt Gushee <mgushee@havenrock.com> writes:

> (Note to OCaml team: can we *please* get some kind of
> history-editing functionality in the toplevel? I know there are
> licensing and portability issues with GNU readline, but what about
> the getline library used by OCaml2?)


ledit is there for this. You can found it in the ocaml bazaar :
http://caml.inria.fr/distrib/bazar-ocaml/

[...]


-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat

-------------------
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] 9+ messages in thread

* Ledit (was Re: [Caml-list] how to use a module)
  2003-07-01 10:32   ` Remi Vanicat
@ 2003-07-01 18:29     ` Matt Gushee
  2003-07-01 18:41       ` Manos Renieris
  2003-07-01 18:49       ` Neel Krishnaswami
  0 siblings, 2 replies; 9+ messages in thread
From: Matt Gushee @ 2003-07-01 18:29 UTC (permalink / raw)
  To: caml-list

On Tue, Jul 01, 2003 at 12:32:46PM +0200, Remi Vanicat wrote:
> Matt Gushee <mgushee@havenrock.com> writes:
> 
> > (Note to OCaml team: can we *please* get some kind of
> > history-editing functionality in the toplevel? I know there are
> 
> ledit is there for this. You can found it in the ocaml bazaar :
> http://caml.inria.fr/distrib/bazar-ocaml/

Okay, then, I have some questions about ledit:

  How do you use it? I have actually tried ledit 2 or 3 times, but if
    I invoke the 'ledit' executable that is created, e.g.

      $ ./ledit

    I get ... something ... some sort of shell-like environment, I
    guess. But all it does is echo whatever I type. And when I read your
    post, I downloaded it again to be sure, but the same thing happened
    again. I also tried making a custom toplevel with ledit, but the
    result seems to be identical to the plain ledit executable.

  Is there any objection in principle to including ledit with the main
    OCaml distribution? It needn't be in the default configuration, but
    if someone could get the OCaml source, then do

      ./configure -with-ledit
      make all
      make opt
      make install

    and have a ledit-enabled toplevel, wouldn't that be a good thing? If
    not, why not?

I think that if a language is going to have an interactive programming
environment, it should be pleasant to work with. And unless you are a
perfect typist, the lack of history editing makes the OCaml toplevel
very unpleasant to work with.

Now for me, and probably for most people on this list, that's just an
annoyance. But what would it mean for beginning programmers who might
encounter OCaml without having the background to understand why it's so
cool? Suppose a programming instructor decides to teach Python and OCaml
... some students might decide they like Python and not OCaml because
Python is easy to work with interactively and OCaml isn't. Admittedly,
that's kind of a silly reason, but the fact that someone starts doing
something for a silly reason doesn't mean that they will always be silly
about it.

So my point is, a toplevel with history editing could help OCaml's
popularity. And unless you take the elitist view that "OCaml is for
those with the intelligence and/or background to handle it," that is a
desirable result, isn't it?

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
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] 9+ messages in thread

* Re: Ledit (was Re: [Caml-list] how to use a module)
  2003-07-01 18:29     ` Ledit (was Re: [Caml-list] how to use a module) Matt Gushee
@ 2003-07-01 18:41       ` Manos Renieris
  2003-07-01 18:49       ` Neel Krishnaswami
  1 sibling, 0 replies; 9+ messages in thread
From: Manos Renieris @ 2003-07-01 18:41 UTC (permalink / raw)
  To: caml-list

On Tue, Jul 01, 2003 at 12:29:10PM -0600, Matt Gushee wrote:
> On Tue, Jul 01, 2003 at 12:32:46PM +0200, Remi Vanicat wrote:
> > Matt Gushee <mgushee@havenrock.com> writes:
> > 
> > > (Note to OCaml team: can we *please* get some kind of
> > > history-editing functionality in the toplevel? I know there are
> > 
> > ledit is there for this. You can found it in the ocaml bazaar :
> > http://caml.inria.fr/distrib/bazar-ocaml/
> 
> Okay, then, I have some questions about ledit:
> 
>   How do you use it? 

ledit ocaml
runs ocaml under ledit, so you get history editing for ocaml.

ledit -h
gives a bit of help.

-- Manos

-------------------
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] 9+ messages in thread

* Re: Ledit (was Re: [Caml-list] how to use a module)
  2003-07-01 18:29     ` Ledit (was Re: [Caml-list] how to use a module) Matt Gushee
  2003-07-01 18:41       ` Manos Renieris
@ 2003-07-01 18:49       ` Neel Krishnaswami
  2003-07-01 19:24         ` Matt Gushee
  2003-07-01 20:51         ` Karl Zilles
  1 sibling, 2 replies; 9+ messages in thread
From: Neel Krishnaswami @ 2003-07-01 18:49 UTC (permalink / raw)
  To: Matt Gushee; +Cc: caml-list

Matt Gushee writes:
> 
> Okay, then, I have some questions about ledit:
> 
>   How do you use it? I have actually tried ledit 2 or 3 times, but if
>     I invoke the 'ledit' executable that is created, e.g.
> 
>       $ ./ledit
> 
>     I get ... something ... some sort of shell-like environment, I
>     guess. But all it does is echo whatever I type. And when I read your
>     post, I downloaded it again to be sure, but the same thing happened
>     again. I also tried making a custom toplevel with ledit, but the
>     result seems to be identical to the plain ledit executable.

Do this

  $ ledit ocaml

in order to get line editing in the ocaml toplevel. The really cool
thing about ledit is that it adds line editing to *any* program.

-- 
Neel Krishnaswami
neelk@alum.mit.edu

-------------------
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] 9+ messages in thread

* Re: Ledit (was Re: [Caml-list] how to use a module)
  2003-07-01 18:49       ` Neel Krishnaswami
@ 2003-07-01 19:24         ` Matt Gushee
  2003-07-01 20:51         ` Karl Zilles
  1 sibling, 0 replies; 9+ messages in thread
From: Matt Gushee @ 2003-07-01 19:24 UTC (permalink / raw)
  To: caml-list

On Tue, Jul 01, 2003 at 02:49:22PM -0400, Neel Krishnaswami wrote:
> 
> Do this
> 
>   $ ledit ocaml
> 
> in order to get line editing in the ocaml toplevel. The really cool
> thing about ledit is that it adds line editing to *any* program.

Aha! Yes, that is cool. Thank you.

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
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] 9+ messages in thread

* Re: Ledit (was Re: [Caml-list] how to use a module)
  2003-07-01 18:49       ` Neel Krishnaswami
  2003-07-01 19:24         ` Matt Gushee
@ 2003-07-01 20:51         ` Karl Zilles
  1 sibling, 0 replies; 9+ messages in thread
From: Karl Zilles @ 2003-07-01 20:51 UTC (permalink / raw)
  Cc: Matt Gushee, caml-list

Neel Krishnaswami wrote:
> Do this
> 
>   $ ledit ocaml
> 
> in order to get line editing in the ocaml toplevel. The really cool
> thing about ledit is that it adds line editing to *any* program.
> 

Doesn't ledit only support the emacs style editing.  If I use the vi 
style, then I'm pretty much out of luck, no?

Karl

-------------------
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] 9+ messages in thread

* [Caml-list] how to use a module
@ 2003-06-27 18:05 Jung Woon Ho
  0 siblings, 0 replies; 9+ messages in thread
From: Jung Woon Ho @ 2003-06-27 18:05 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/html, Size: 873 bytes --]

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

end of thread, other threads:[~2003-07-01 20:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-30 20:11 [Caml-list] how to use a module Jean-Baptiste Rouquier
2003-07-01  1:49 ` Matt Gushee
2003-07-01 10:32   ` Remi Vanicat
2003-07-01 18:29     ` Ledit (was Re: [Caml-list] how to use a module) Matt Gushee
2003-07-01 18:41       ` Manos Renieris
2003-07-01 18:49       ` Neel Krishnaswami
2003-07-01 19:24         ` Matt Gushee
2003-07-01 20:51         ` Karl Zilles
  -- strict thread matches above, loose matches on Subject: below --
2003-06-27 18:05 [Caml-list] how to use a module Jung Woon Ho

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