getify / Functional-Light-JS

Pragmatic, balanced FP in JavaScript. @FLJSBook on twitter.
http://FLJSBook.com
Other
16.64k stars 1.96k forks source link

Development Edit: Chapter 9 #66

Closed bmacdonald-editor closed 7 years ago

bmacdonald-editor commented 7 years ago

Perhaps it's because of my more formal education on FP, but I regard recursion as a core tenet of FP, and if anything, I think this intro could emphasize that fact more than it does.

Definition section

I think your second illustration could be made clearer if you had a visual representation of the call stack. Then you could show it unwinding. I can see you want to defer the discussion of the call stack until later in the chapter, but a cursory use of it here would make the illustration clearer.

Mutual recursion section

"While these mutual recursion examples shown are rather contrived, there are more complex use cases where mutual recursion can be very helpful." This sentence begs for a "such as" at the end of it. You don't have to explain in detail how it works, but just citing the use cases would provide some grounding.

Declarative Recursion section

In your binary tree example at the end, it probably wouldn't hurt to mention that just about anything you want to do with a binary tree is better done with recursion.

Proper Tail Calls section

"It may be possible to achieve PTC from a multiple-recursive algorithm by splitting each into separate function calls, where each is expressed respectively in PTC form." Is that something worth showing, or would it be too complicated?