Recursion in Julia — bad idea?

To add on this:
Learning recursion without hitting the stack limit is NOT learning recursion.

Learning about algorithms and programming techniques should include the underlying principles of how processors and memory management work. Recursion and the stack is an example on why this is important. Another examples: Integer operations and overflow, float operations and precision, there are many more.

Even if modern software development doesn’t need to use registers and memory addresses anymore, it is good for a general understanding of software, to know what’s going on in the CPU and in the memory. Basic data types for example do have a correspondence in the memory architecture of the machines. This makes it easier to understand why there is something like an Int64. The binary representation of numbers in computers, as an extreme example, is not a mandatory knowledge for many programming tasks, but it should be definitely known, as, I guess, many would agree.

Therefor: Julia is perfect for learning recursion. Next level: perfect for learning how to do the same in loops. Next level: perfect to learn about tail recursion and it’s optimization.

That would bring the principles into relation to each other and in relation to the hardware. Those relations makes it easier(!) to learn, comprehend and remember them.

4 Likes