Note this doesn’t mean that your code is side-effect free. As an extreme example, consider something like next(foo) in Python where foo is an iterator.
Those are some pretty good definitions. I think metaphors and code examples are better for teaching new people, though. SQL and HTML vs regular code were good choices by the author. A classic one is Prolog examples with a brief explanation of the backtracking behind the scenes that makes it possible. Author’s was easier to digest than that.
I’d argue that
While more declarative than looping through the array, is still more imperative than something like
arr.sum. Here’s how I define the difference:Note this doesn’t mean that your code is side-effect free. As an extreme example, consider something like
next(foo)in Python wherefoois an iterator.tl;dr everything is fractals
Those are some pretty good definitions. I think metaphors and code examples are better for teaching new people, though. SQL and HTML vs regular code were good choices by the author. A classic one is Prolog examples with a brief explanation of the backtracking behind the scenes that makes it possible. Author’s was easier to digest than that.