Accueil     À propos     Téléchargement     Ressources     Contactez-nous

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2004-04-28 (17:34) From: Shivkumar Chandrasekaran Subject: [Caml-list] Re: [ANN] The Missing Library

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