On Sat, 25 Dec 2010, gutti wrote:

this line works :

matrixfunction x y = liftMatrix2 (zipVectorWith(\a1 a2 -> if a2>=0 then a1 else 
0)) x y

but when I use this line :

matrixfunction f x y = liftMatrix2 (zipVectorWith f) x y

how can / do I have to define f in a seperate line a way, that it works and
gives the same result ?

The same way you have literally replaced
  (\a1 a2 -> if a2>=0 then a1 else 0)
by 'f' at the right hand side, you can use that phrase as argument to the parameter 'f':

  matrixfunction (\a1 a2 -> if a2>=0 then a1 else 0) x y


The lambda expression (\ ...) really is just a notation for a function.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to