RE: Library report examples

2001-11-27 Thread Simon Peyton-Jones
| The library report defines | | -- Diagonal of a square matrix | diag :: (Ix a) = Array (a,a) b - Array a b | diag x = ixmap (l,u) (\i-(i,i)) x |where ((l,l'),(u,u')) | l == l' u == u' = bounds x And that is indeed a stupid definition. It's like saying x = if x2 then 1

Re: Library report examples

2001-11-27 Thread Ian Lynagh
Simon, On Tue, Nov 27, 2001 at 02:28:45AM -0800, Simon Peyton-Jones wrote: | I am also curious why, for example, | | row :: (Ix a, Ix b) = a - Array (a,b) c - Array b c | row i x = ixmap (l',u') (\j-(i,j)) x where ((l,l'),(u,u')) | = bounds x | | isn't written as | | row ::

Library report examples

2001-11-26 Thread Ian Lynagh
Hi guys, The library report defines -- Diagonal of a square matrix diag :: (Ix a) = Array (a,a) b - Array a b diag x = ixmap (l,u) (\i-(i,i)) x where ((l,l'),(u,u')) | l == l' u == u' = bounds x but ghc, hugs and nhc98 all loop (trying to get and test the value of l I believe). I