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 WAA02158; Sun, 26 Sep 2004 22:43:37 +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 WAA32553 for ; Sun, 26 Sep 2004 22:43:36 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8QKhXAI030495 for ; Sun, 26 Sep 2004 22:43:35 +0200 Received: from [192.168.1.200] (ppp202-133.lns1.syd3.internode.on.net [203.122.202.133]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i8QKhT4Y069160; Mon, 27 Sep 2004 06:13:31 +0930 (CST) Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features From: skaller Reply-To: skaller@users.sourceforge.net To: Jon Harrop Cc: caml-list In-Reply-To: <200409261951.52609.jon@jdh30.plus.com> References: <20040925225246.48566.qmail@web53010.mail.yahoo.com> <200409261405.37558.jon@jdh30.plus.com> <1096209379.28613.64.camel@pelican.wigram> <200409261951.52609.jon@jdh30.plus.com> Content-Type: text/plain Message-Id: <1096231409.28613.323.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 27 Sep 2004 06:43:29 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 415729F5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 isomorphic:01 trade-off:01 enums:01 boils:01 9660:01 glebe:01 ocaml:01 ocaml:01 nsw:01 trivial:01 trivial:01 snail:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 2004-09-27 at 04:51, Jon Harrop wrote: > I think you're thinking of a function to convert between 'a and 'b container > types. The requirement is for a polyadic map. Here is the type signature: map: ('a -> 'b) -> 'a 'F -> 'b 'F Here, 'F is a variable for 'list' or 'array'. You cannot do that in Ocaml. Of course for given 'F, made of sums, products and induction, you can write the code for map_F, eg map_list, map_array, map_tree, and you can do it 'mechanically'. But Ocaml can't. Note: the output must have exactly the same shape as the input: map preserves shape, it only changes the values stored in the 'slots' of the data structure. So a weird tree or graph has to come out isomorphic to its input. > You mean there is a trade-off of functionality between more- and less-capable > type systems? No, I mean that trivial but useful cases of Object Orientation exist but in general it doesn't work. Similarly, trivial cases of polyadic programming can be done with the trick of using iterators or some other sequential representation such as Enums, but it isn't a general solution -- it only works for sequences. > > Accumulate can accept a function object argument. > > C++ DOES have higher order functions. > > That statement is so HOF-definition dependent that it boils down to "C++ is > Turing complete". I agree :) > > [Did I miss something .. ? :] > > Good looking programmers. LOL! -- 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