4 ms·
Ya that's the problem. Here's what I originally intended to write, but couldn't think of how to do cons in haskell so I used list addition. With cons (:), you c
by Psyonic 16y ago
Ya that's the problem. Here's what I originally intended to write, but couldn't think of how to do cons in haskell so I used list addition. With cons (:), you can't rewrite it with the arguments swapped, so no simple mechanical transform will be able to fix this.
blah 0 = []
blah n = (:) n (blah ((-) n 1))
-- blah 5 -> [5,4,3,2,1]
blah2 0 acc = acc
blah2 n acc = blah2 ((-) n 1) ((:) n acc)
-- blah2 5 [] -> [1,2,3,4,5]