In Scala's foldLeft
, I know how to access the accumulator
and element
values in Scala, but not Haskell.
I could use foldLeft
to find out, between 1 and 100, how many numbers have a remainder of 1 when divided by 3:
scala> List.range(1, 101).foldLeft(0){ (acc, elem) =>
| if (elem % 3 == 1) acc + 1
| else acc
| }
res2: Int = 33
How can I do the same in Haskell?