3 ms·
I believe it should be something along the lines of: sumacc xs = summer xs 0 where summer [] n = n summer (x:xs) n = summer xs (x+n) I'm sure
by malisper 12y ago
I believe it should be something along the lines of:
sumacc xs = summer xs 0
where summer [] n = n
summer (x:xs) n = summer xs (x+n)
I'm sure there are macros in some library somewhere that implement pattern matching in lisp (regardless of dialect).