Browse thread
[Caml-list] Dynamically evaluating OCaml code
-
John Goerzen
- Vitaly Lugovsky
- Samuel Mimram
-
Basile Starynkevitch
-
Issac Trotts
- Dustin Sallings
-
Brian Hurt
- Oleg Trott
- Ville-Pertti Keinonen
-
John Goerzen
-
Markus Mottl
-
Richard Jones
-
Markus Mottl
- Jon Harrop
-
John Goerzen
-
Jean-Marc EBER
-
Kenneth Knowles
- John Goerzen
- John Goerzen
-
Kenneth Knowles
-
Trevor Andrade
-
Gerd Stolpmann
- skaller
-
John Goerzen
-
Gerd Stolpmann
-
Christophe TROESTLER
-
Gerd Stolpmann
-
Christophe TROESTLER
- Brandon J. Van Every
- John Goerzen
- Jacques GARRIGUE
-
Christophe TROESTLER
-
Gerd Stolpmann
-
Christophe TROESTLER
- Matt Gushee
-
Gerd Stolpmann
- Benjamin Geer
-
Gerd Stolpmann
-
Jean-Marc EBER
- skaller
-
Markus Mottl
- John Goerzen
- Jon Harrop
-
Richard Jones
- Fernando Alegre
- Jean-Marc EBER
- Kenneth Knowles
- Brian Hurt
- skaller
-
Markus Mottl
- Issac Trotts
- Basile Starynkevitch
-
Issac Trotts
- clement capel
- Jon Harrop
- Walid Taha
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Goerzen <jgoerzen@c...> |
| Subject: | Re: [Caml-list] Dynamically evaluating OCaml code |
On Thu, Apr 08, 2004 at 11:20:44AM -0700, Kenneth Knowles wrote: > On Thu, Apr 08, 2004 at 07:59:04PM +0200, Jean-Marc EBER wrote: > > I don't need to mention that your previous particular problem is so > > trivial that it could easily be expressed with arrays as a "one > > liner" of caml code... Look at Array.sub... > > This is also a general principle - O'Caml is concise enough that a lot > of helper functions you would expect in imperative scripting languages > or C are too simple to include, for the sake of cleanliness. I That's an excellent practice, one I am still adjusting to. For instance, "String.make 1" makes sense as an alternative to String.string_of_char. However, while perhaps someone could design a more advanced String.sub that can count backwards from the end of the string (I posted one such example) in one line of the code, it may still have merit being in the library. Otherwise, everyone will probably end up writing a function anyway (since it's too ugly to use inline with any frequency) and this reduces the efficiency of programming with OCaml. > By the way, list slicing has the same complexity as Array.of_list and > then Array.sub so it is, in fact, in the standard library. Don't even > bother talking about efficiency at a lower level than complexity of > algorithms until you have a complete, profiled program - and of course > you are talking about disk access so there's not a chance of the > slicing being a bottleneck. My simplified example does not necessary represent all possible ones. Some people may be dealing with 500MB structures where going back and forth between lists and arrays is not even an executable option. -- 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