[Haskell-cafe] zipWith and divide

Rehno Lindeque rehno.lindeque at gmail.com
Sun Jun 7 13:33:48 UTC 2015


Hi!
 

> zipWith(\) z1 z2  ........ this fails but works when using * or + or - 
> ....... I also tried using div and `div` but they failed to.
>

The divide operator is slash (/) not backslash (\):

> zipWith (/) [0.1, 0.2] [0.2, 0.4]
[0.5,0.5]


Also, div should work as long you're using a Integral type like Int (you 
may be using Float or Double):

> zipWith div [1, 2] [2, 2]
[0,1]


Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150607/d097f612/attachment.html>


More information about the Haskell-Cafe mailing list