caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] use of `generics'
@ 2003-05-23 21:38 William Lovas
  2003-05-24  7:15 ` [Caml-list] List to Tuple Siegfried Gonzi
  0 siblings, 1 reply; 4+ messages in thread
From: William Lovas @ 2003-05-23 21:38 UTC (permalink / raw)
  To: caml-list

Hi,

Apologies for the slightly off-topic nature of this posting, but i hope
people on the list can provide some insight.

Everytime a discussion pops up on the list about extensional polymorphism,
this question comes to my mind: why does the O'Caml community use the word
`generics' to refer to ad-hoc polymorphism, while e.g. the Java community
uses the same word to refer to parametric polymorphism?

Is it just standard practice for a community to use `generics' to refer to
"the kind of polymorphism we don't have"? :)

cheers,
William

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Caml-list] List to Tuple
  2003-05-23 21:38 [Caml-list] use of `generics' William Lovas
@ 2003-05-24  7:15 ` Siegfried Gonzi
  2003-05-24 10:41   ` Michal Moskal
  0 siblings, 1 reply; 4+ messages in thread
From: Siegfried Gonzi @ 2003-05-24  7:15 UTC (permalink / raw)
  To: caml-list


I couldn't find the function which converts a List to a Tuple type. 
PsiLAb for example expects for initializing of arrays a Tuple construct:

let a = imatrix ~const:[1,2,3 ; 4,5,6] ();;

which would yield:  

1 2 3
4 5 6

But I think the common case actually is that one has something like 
this: [[1;2;3];[4;5;6]]. How to convert this to: [1,2,3 ; 4,5,6] ?

Another question. PsiLAB relies in Bigarrays. How is it possible to 
convert a OCaml array to bigarray? The OCaml book has a chapter about 
bigarrays but no concrete examples how to do this.                    
                   

S. Gonzi

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] List to Tuple
  2003-05-24  7:15 ` [Caml-list] List to Tuple Siegfried Gonzi
@ 2003-05-24 10:41   ` Michal Moskal
  2003-05-24 13:58     ` Siegfried Gonzi
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Moskal @ 2003-05-24 10:41 UTC (permalink / raw)
  To: Siegfried Gonzi; +Cc: caml-list

On Sat, May 24, 2003 at 09:15:49AM +0200, Siegfried Gonzi wrote:
> I couldn't find the function which converts a List to a Tuple type.

ML type system isn't powerfull enough to express this construct, best
you can have is:

val conv2 : 'a * 'a -> 'a list
val conv3 : 'a * 'a * 'a -> 'a list
...

I'm not quite sure if it will change with generics.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] List to Tuple
  2003-05-24 10:41   ` Michal Moskal
@ 2003-05-24 13:58     ` Siegfried Gonzi
  0 siblings, 0 replies; 4+ messages in thread
From: Siegfried Gonzi @ 2003-05-24 13:58 UTC (permalink / raw)
  To: Michal Moskal; +Cc: caml-list

Michal Moskal wrote:

>On Sat, May 24, 2003 at 09:15:49AM +0200, Siegfried Gonzi wrote:
>
>>I couldn't find the function which converts a List to a Tuple type.
>>
>
>ML type system isn't powerfull enough to express this construct, best
>you can have is:
>
>val conv2 : 'a * 'a -> 'a list
>val conv3 : 'a * 'a * 'a -> 'a list
>...
>
>I'm not quite sure if it will change with generics.
>

I also contacted the author of PsiLAB, because it is quite strange to 
have such a format. PisLAB as the manual claims is more or less 
integrated into OCaml and in my opinion the common case are/should be 
list constructs.

Regards,
S. Gonzi

>
>



-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-24 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-23 21:38 [Caml-list] use of `generics' William Lovas
2003-05-24  7:15 ` [Caml-list] List to Tuple Siegfried Gonzi
2003-05-24 10:41   ` Michal Moskal
2003-05-24 13:58     ` Siegfried Gonzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).