Example 4-11. A factorial written with the counting-up approach
You really don't need to use three parameters/variables to accomplish this. If you decrement n and calculate the new result as the second parameter, while defaulting it to 1, you can drop this down to 2 parameters. factorial(n-1, n*result).
Share this highlighthttp://www.safaribooksonline.com/a/introducing-elixir/137486/