Function object: Difference between revisions

Content deleted Content added
Ljrk (talk | contribs)
Added reference to the application of the category concept of functors in functional programming; clarified that this article applies not to all of computer programming in general, specifically functional programming languages use it differently (i.e., more in line with the mathematical definition)
Tags: Mobile edit Mobile web edit
In Julia: lang="julia-repl"
Line 381:
An example is this accumulator mutable struct (based on [[Paul Graham (computer programmer)|Paul Graham's]] study on programming language syntax and clarity):<ref>[http://www.paulgraham.com/accgen.html Accumulator Generator]</ref>
 
<syntaxhighlight lang="julia-repl">
julia> mutable struct Accumulator
n::Int
Line 408:
Such an accumulator can also be implemented using closure:
 
<syntaxhighlight lang="julia-repl">
julia> function Accumulator(n0)
n = n0