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 UAA01883; Thu, 8 Apr 2004 20:40:00 +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 UAA01911 for ; Thu, 8 Apr 2004 20:39:59 +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 i38Ieqjq003139 for ; Thu, 8 Apr 2004 20:40:52 +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 4D50CE0140; Thu, 8 Apr 2004 13:39:57 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 12B895C006; Thu, 8 Apr 2004 13:39:57 -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 84F2F5C005; Thu, 8 Apr 2004 13:39:56 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id 30DA71C03E; Thu, 8 Apr 2004 13:39:57 -0500 (CDT) Date: Thu, 8 Apr 2004 13:39:57 -0500 From: John Goerzen To: Kenneth Knowles Cc: Jean-Marc EBER , Ocaml Mailing List Subject: Re: [Caml-list] Dynamically evaluating OCaml code Message-ID: <20040408183957.GB2311@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> <20040408182044.GA18551@tallman.kefka.frap.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040408182044.GA18551@tallman.kefka.frap.net> 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 knowles:99 2004:99 helper:01 cleanliness:01 char:01 bottleneck:01 arrays:01 arrays:01 ocaml:01 ocaml:01 caml:01 0700,:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 175 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