[Haskell-cafe] Rewrite this imperative in FP way

Haisheng Wu freizl at gmail.com
Sun Feb 5 07:28:10 CET 2012

a = [1,1,1,1]
b = [0,1,2,3]
d = [0,0,0,0]

for i in b:
  for j in c:
    if (i+j)<3:
      d[i+j] += a[i]

My just work implementation in Haskell

Another people implementation in Haskell with Monad and it turns out
complex and very imperatively.

Do you have any cool solution in FP way?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120205/d8017c4f/attachment.htm>

More information about the Haskell-Cafe mailing list