Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
ambitious proposal: polymorphic arithmetics
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-04-09 (03:16)
From: Eijiro Sumii <eijiro.sumii@g...>
Subject: Re: [Caml-list] ambitious proposal: polymorphic arithmetics
> I'm just curious, but what would you have expected the result of:
> # (1, 2, 3) * (2, 3, 4);;
> to be? i.e. an inner product, element-wise multiplication or an outer product?

Right, it is one of the difficult cases, but in general I just had
simple element-wise operations (of type 'a -> 'a -> 'a) in mind.

> > If so, I can perhaps restate my question as: why is the line drawn between =
> > and + now?
> I would say that polymorphic comparisons are useful in many more circumstances
> than polymorphic arithmetics would be, so their inclusion is justified.

Yes, I agree polymorphic equality can be more useful in practice,
though I'm not very sure about polymorphic inequalities (perhaps
except for the purpose of ordering when implementing containers such
as sets, trees, ...), in particular concerning abstract types as
somebody else mentioned...?