[][src]Module show_notes::e005

Allocate it where?

Notes

This episode, we look at returning functions from other functions, and as part of that discuss some basics about the stack and the heap---and why we need to care about them for returning functions.

The functions themselves are not especially interesting; they just show you the basic form you use to return functions from other functions, and how to then use them in another function. You'll want to take a detailed look instead at the documentation for each (or just read the source!), because that's where the meat of the discussion in this week's code is.

Corrigenda

Thanks to Steve and Chad for their helpful feedback!

Links

Sponsors

Become a sponsor

Follow

Functions

demonstrate_function_returns

Uses the doubler_factory to get a function which doubles a number.

doubler_closure_factory

Creates a closure which doubles an integer.

doubler_factory

Creates a function which doubles an integer.