Sorry there is a mistake in the problem description.
a = [1,1,1,1] b = [0,1,2,3] c = [0,2] d = [0,0,0,0] for i in b: for j in c: if (i+j)<3: d[i+j] += a[i]
-Haishenga = [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 HaskellAnother people implementation in Haskell with Monad and it turns out complex and very imperatively.Do you have any cool solution in FP way?Thanks.-Simon