[Haskell-cafe] Re: Tutorial on Haskell

apfelmus apfelmus at quantentunnel.de
Tue Apr 17 07:06:25 EDT 2007


ajb at spamcop.net wrote:
> OK, it's not pretty, but this is diff(1) in 120 lines:
> 
>     http://andrew.bromage.org/darcs/diff/

(Btw, pairs (Int,Int) are members of the Ix class as well, so there is
no need to generate an array of arrays. You can just pretend that one
array is indexed by pair of Ints

  table =
     array ((0,0),(lxs-1,lys-1))
     [((i,j), cell i j x y) |
         (i,x) <- zip [0..] xs, (j,y) <- zip [0..] ys]

)

Regards,
apfelmus



More information about the Haskell-Cafe mailing list