News for hackers. Stuff that matters.
Re:Thinking About Recursion by skybrian on Sunday October 11, 2020 @06:39PM (#24749735)
It was effectively a parsing problem. When building a tree recursively, it's natural to return the finished subtree, but more information was needed to keep track of what gets parsed next. You would need to return both the result and the start of the unparsed input.

In imperative languages, parsers are often written using the fields of an object or struct to hold the parser state. But if you're just writing a single function then it becomes more natural to keep the parser state in local variables, and recursion means you don't have easy access to it.

Re:Thinking About Recursion by Jtsummers on Sunday October 11, 2020 @07:24PM (#24749990)
That makes sense, thanks.