To view functions merely as canned chunks of code doesn't do them justice though. When needed, they can play the role of pure functions, algorithms.
A pure function is defined as one that doesn't depend on or modify variables outside of its scope. That's a bit of a mouthful, so let's dive into...
- WIKI MITCHELL JOHNSON ANDREW GOLDEN
As input, this function clearly needs access to the command line arguments. It not only occurs when deciding for or against recursion. After these two articles, you should have a good foundation for making your own code more functional. Some languages, like Haskell, are completely built on lazy evaluation. Functions map input arguments to return values, meaning that for each set of inputs, there exists an output. Look at this implementation. There is no context to set up, no current account, request, or user.