Name: Anonymous 2010-03-26 11:27
I've been going through SICP, first in Scheme and then in Haskell, and I started wondering...
Is my Haskell too Lisp-y?
Is my Haskell too Lisp-y?
filterAccumulate
:: (Eq t1) =>
(t1 -> Bool) -> (t2 -> t3 -> t3) -> t3 -> (t1 -> t2) -> t1 -> (t1 -> t1) -> t1 -> t3
filterAccumulate filter combiner nullVal term a next b =
iter a nullVal
where
iter a result =
if (a == b) then filterCombiner a result
else iter (next a) (filterCombiner a result)
filterCombiner a result =
if (filter a) then combiner (term a) result
else result