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 HAA06760; Fri, 9 Apr 2004 07:04:34 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA06475 for ; Fri, 9 Apr 2004 07:04:32 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3954TYM005556 for ; Fri, 9 Apr 2004 07:04:30 +0200 Received: from [192.168.1.200] (ppp116-94.lns1.syd2.internode.on.net [150.101.116.94]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i3954IeZ013260; Fri, 9 Apr 2004 14:34:19 +0930 (CST) Subject: Re: [Caml-list] Dynamically evaluating OCaml code From: skaller Reply-To: skaller@users.sourceforge.net To: John Goerzen Cc: Brian Hurt , Issac Trotts , Ocaml Mailing List In-Reply-To: <20040408133727.GC29195@excelhustler.com> References: <20020104004356.GA1672@mev> <20040408133727.GC29195@excelhustler.com> Content-Type: text/plain Message-Id: <1081487057.20677.30.camel@pelican> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 09 Apr 2004 15:04:18 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at concorde 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 sourceforge:01 2004:99 python:01 char:01 newbie:01 criticism:01 hashtbl:01 hashtbl:01 python:01 iterator:01 functorial:01 9660:01 glebe:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Keywords: X-UID: 192 On Thu, 2004-04-08 at 23:37, John Goerzen wrote: > I'm still relatively new to > OCaml, having been using it for only a couple of months, > Basic string processing is also more difficult than a language such as, > say, Python, where I can say, for instance: > Also, there is no string_of_char function (I'd have to use fill). As a newbie, you'll think these omission more serious than a more seasoned Ocaml programmer, IMHO. The reason is, most of these things are just *so* easy to define as you want in Ocaml, compared to other languages. I've worked with ultra-rich C++ libraries and have nothing but total criticism of them: there is a function for just about everything you want to do .. if you can find it in the documentation, and if it actually works .. and if the documentation is correct .. and if you can spend hours running test code to determine which combinations are most efficient ... UGGGG! I'm not saying you're wrong, just that the problem here is less than you might expect. Yeah, its a pain writing let list_of_hashtbl cmp h = let x = ref [] in Hashtbl.iter (fun k v -> x := (k,v) :: !x) h; sort cmp !x but truly, it didn't take that long to write (and would be even cuter with a fold .. :D How many C++ users would write: std::copy(ss, se, d) instead of for(p=ss;p!=se;)*d++=*p++; The BIG advantage Python and C++ have over Ocaml here is that they have coherent library design concepts. Both Python and C++ have a serialisation (iterator/sequence) concept and one of associative containers, and both provide syntactic support. (Python with things like for loops and slices, C++ with STL). The real problem in Ocaml is that the right way to do this is functorial polymorphism, which is still pretty bleeding edge. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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