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 TAA11569; Wed, 28 Apr 2004 19:34:12 +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 TAA11556 for ; Wed, 28 Apr 2004 19:34:11 +0200 (MET DST) Received: from xanadu.ece.ucsb.edu (xanadu.ece.ucsb.edu [128.111.56.51]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3SHY9YM003267 for ; Wed, 28 Apr 2004 19:34:10 +0200 Received: from [128.111.56.252] (gimli.ece.ucsb.edu [128.111.56.252]) by xanadu.ece.ucsb.edu (8.12.10/8.12.10) with ESMTP id i3SHY7eO014358 for ; Wed, 28 Apr 2004 10:34:08 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: <1083172450.9537.1149.camel@pelican.wigram> 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> <1083172450.9537.1149.camel@pelican.wigram> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <3E013214-993A-11D8-AABC-000393942C76@ece.ucsb.edu> Content-Transfer-Encoding: 7bit From: Shivkumar Chandrasekaran Subject: [Caml-list] Re: [ANN] The Missing Library Date: Wed, 28 Apr 2004 10:34:03 -0700 To: caml-list X-Mailer: Apple Mail (2.613) 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; shivkumar:01 shiv:01 generalised:01 rank:99 rank:99 calc:01 generalised:01 map's:01 generic:01 --shiv--:01 arrays:01 ocaml:01 ocaml:01 int:01 identical:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Apr 28, 2004, at 10:14 AM, skaller wrote: > 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. Not sure exactly where this is going, but I do have ocaml code where n is just a parameter, and the code works across n-dimensional arrays. Maybe you have something more general in mind since I am not familiar with FISh1. > > 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. Clean 2.0 can automatically handle your case (I believe). It can produce the different map's, each with a different type, automatically from one generic definition. Check it out! --shiv-- ------------------- 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