November 2017
Beginner
316 pages
6h 40m
English
Or, in simpler words, functions defined within functions. For those coming from other language backgrounds, such as Python, the concept of closures should be very easily applicable to Julia. A Closure is a function object that remembers values in enclosing scopes even if they are not present in memory.
Nesting helps in places where you want to mask the real implementation of the function from the end user.
Let's just define a function with the name outer and another function inside it with the name inner:
julia> function outer(value_a) function inner(value_b) return value_a * value_b end endouter (generic function with 1 method)
If you look closely, we are passing two different arguments to both functions and then utilizing ...
Read now
Unlock full access