[Haskell-cafe] Simple matrix

Bjorn Lisper lisper at it.kth.se
Mon Jun 26 02:19:46 EDT 2006


Udo Stenzel:
>Bjorn Lisper wrote:
>> - your definition of fromInteger will behave strangely with the elementwise
>>   extended operations, like (+). 1 + [[1,2],[3,4]] will become
>>   [[2,2],[3,5]] rather than [[2,3],[4,5]]. Array languages supporting this
>>   kind of overloading invariably have the second form of semantics.
>
>Don't call an array a matrix.  If is named matrix, it should have
>matrix multiplication, addition, and they should obey the expected laws.  

But you still have the problem with the overloading of constants in your
proposal. If you write 17 + a, where a is a matrix, what do people in
general expect it to be?

Björn Lisper


More information about the Haskell-Cafe mailing list