3 ms·
1) When you're writing a function on integers or lists using explicit recursion, usually there's need for only one base case. Do you really need a separate defi
by nandemo 15y ago
1) When you're writing a function on integers or lists using explicit recursion, usually there's need for only one base case. Do you really need a separate definition for pascal 2? What about sum' [1]?
2) Often it's better to use fold instead of explicit recursion. If you wonder whether you can rewrite your function in terms of fold...
"A tutorial on the universality and expressiveness of fold"
http://www.cs.nott.ac.uk/~gmh/fold.pdf http://www.cs.nott.ac.uk/~gmh/fold.pdf