English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Dynamically evaluating OCaml code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-08 (18:29)
From: John Goerzen <jgoerzen@c...>
Subject: Re: [Caml-list] Dynamically evaluating OCaml code
On Thu, Apr 08, 2004 at 07:59:04PM +0200, Jean-Marc EBER wrote:
> >such a slice?  As far as I can tell, there are no standard functions for
> >any of Array or List to do that.  I could write a function for either of
> >them to loop over it and get me what I want, but the point is that this
> >functionality is useful.
> >
> In the time you wrote the previous paragraph, its also possible to write 
> following (of course horribly inefficient, because it inverts two times the 
> argument list) prototype implementation of the function you need, so that 

Not quite; the numbers 2 and 3 are not known in advance, but yes, I did
write a function to accomplish that anyway :-)

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

Is switching a whole thing back and forth between lists and arrays
really efficient?  Like I've said before, arrays aren't so useable in
the non-imperitive sense, and notably I don't think they can be used in
match like x::xs for lists -- which is very useful all over the place.

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