Version française
Home     About     Download     Resources     Contact us    
Browse thread
(int * int) <> int*int ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frédéric_Gava <gava@u...>
Subject: Re: [Caml-list] (int * int) <> int*int ?
>This isn't correct- the same problem shows up in the difference between:
>int*int*int and int*(int*int)- i.e. the difference between (1,2,3) and
>(1,(2,3)).  In the first case (in both examples) I have a three element
>tuple, in the second case I have a two element tuple whose second element
>is also a two element tuple (and thus I have the layer of indirection).

Hum, no...here we have three (int) or two (one int and one pair) elements.
In the concrete type case, we have two elements (and both cases pair because
in both case A (2,3) works fine) and it is a problem of curryfication which
is not justify. (int*int*int)=int*int*int everywhere and also
(int*(int*int))=int*(int*int). But not in the concrete type case...

>Also, sometimes I want one and sometimes I want the other.
Sure

>  I can often
>save copying information (and storing the duplicate information) if I can
>add the level of indirection- this is important if I'm copying the
>information a lot.  On the other hand, if the information isn't being
>duplicated a lot, then I can save memory by not having the extra level of
>indirection.

This is why I thinks that the case (int*int) is not justify if there is no
partial application of the concrete constructors (because the level of
indirection could be avoid at the time of pattern-matching : you quickly
modify the data of the concrete type to have a tuple...).

FG