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 TAA09932; Wed, 28 Apr 2004 19:14:29 +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 TAA09919 for ; Wed, 28 Apr 2004 19:14:27 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3SHEOYM032241 for ; Wed, 28 Apr 2004 19:14:26 +0200 Received: from [192.168.1.200] (ppp119-113.lns1.syd2.internode.on.net [150.101.119.113]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i3SHEBk2012365; Thu, 29 Apr 2004 02:44:12 +0930 (CST) Subject: Re: [Caml-list] Re: [ANN] The Missing Library From: skaller Reply-To: skaller@users.sourceforge.net To: Shivkumar Chandrasekaran Cc: caml-list In-Reply-To: <927F2151-992E-11D8-AABC-000393942C76@ece.ucsb.edu> References: <1083140676.9537.831.camel@pelican.wigram> <1083151902.29774.18.camel@localhost.localdomain> <1083154175.9537.944.camel@pelican.wigram> <927F2151-992E-11D8-AABC-000393942C76@ece.ucsb.edu> Content-Type: text/plain Message-Id: <1083172450.9537.1149.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 29 Apr 2004 03:14:11 +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 sourceforge:01 2004:99 shivkumar:01 generic:01 functorial:01 rank:99 generalised:01 rank:99 calc:01 generalised:01 functorial:01 9660:01 glebe:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 2004-04-29 at 02:10, Shivkumar Chandrasekaran wrote: > Again, this might be off-topic, but the purely functional language > Clean (as of version 2.0 at least) supposedly can do this via ``generic > programming''. It is not clear though how useful it is. I'm not sure what Clean does. However functorial polymorphism is clearly vitally important and extremely powerful. One example which works in FISh 1, which is an array language, is that you can write an algorithm which works for a rank n problem. I have *seen* a heat flow algorithm which can be tested on a 2D object, and the algorithm then applied to a 3D object -- without changing anything. Just try to do that in C or Fortran or Ocaml. You can't. In C for example, a typical operation on a 2D object is a double loop: for(i= for(j= but for 3D you need: for(i= for(j= for(k= that is, you have no choice implementing generalised tensor mathematics than to rewrite the program for every value of n, the rank. Yet the (tensor) maths is identical and independent of the rank. I guess there are numerous other science problems where you do a calc for a certain set of generalised coordinates .. and then need to add more coordinates and recalculate .. only you have to rewrite the program every time. For more general data stuctures of the form type 'a x = X of int * 'a | Y of 'a * 'a | Empty etc, it is clear how to write a map function. But each such data structure has a distinct map function with a distinct type. Actually, if you have fold, you can define map for all such data stuctures: map is just a special case of fold where the output value is a similarly shaped data structure with different value type. So clearly .. with functorial polymorphism you get a LOT more resuable code than at the moment. -- 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