From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA00236; Thu, 8 Apr 2004 20:29:33 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA00281 for ; Thu, 8 Apr 2004 20:29:32 +0200 (MET DST) Received: from gatekeeper.elmer.external.excelhustler.com (gatekeeper.excelhustler.com [68.99.114.105]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i38IUPjq001836 for ; Thu, 8 Apr 2004 20:30:25 +0200 Received: from chatterbox.elmer.internal.excelhustler.com (unknown [192.168.0.12]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "chatterbox.elmer.internal.excelhustler.com", Issuer "excelhustler.com" (not verified)) by gatekeeper.elmer.external.excelhustler.com (Postfix) with ESMTP id BB263E01A1; Thu, 8 Apr 2004 13:29:27 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 8B8575C006; Thu, 8 Apr 2004 13:29:27 -0500 (CDT) Received: from wile.internal.excelhustler.com (wile.internal.excelhustler.com [192.168.1.34]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 625E05C005; Thu, 8 Apr 2004 13:29:27 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id 0F7FA1C03E; Thu, 8 Apr 2004 13:29:28 -0500 (CDT) Date: Thu, 8 Apr 2004 13:29:28 -0500 From: John Goerzen To: Jean-Marc EBER Cc: Ocaml Mailing List Subject: Re: [Caml-list] Dynamically evaluating OCaml code Message-ID: <20040408182928.GA2170@excelhustler.com> References: <20020104004356.GA1672@mev> <20040408133727.GC29195@excelhustler.com> <20040408145606.GA18473@fichte.ai.univie.ac.at> <20040408151427.GA740@redhat.com> <20040408152654.GB18473@fichte.ai.univie.ac.at> <20040408155833.GG30763@excelhustler.com> <407592E8.6080500@lexifi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <407592E8.6080500@lexifi.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Scanned-By: clamscan at chatterbox.elmer.internal.excelhustler.com X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dynamically:01 2004:99 arrays:01 arrays:01 inefficient:01 ocaml:01 caml:01 0200,:01 trivial:01 eber:02 match:02 wrote:03 wrote:03 jean-marc:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 172 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