Julia: Difference between revisions

401 bytes added ,  9 September 2019
no edit summary
No edit summary
No edit summary
Line 24: Line 24:
"Variable x is $x, y is $y, and x+y is $(x+y)"
"Variable x is $x, y is $y, and x+y is $(x+y)"
</syntaxhighlight>
</syntaxhighlight>
===Higher order functions===
Julia supports high-order functions.<br>
<syntaxhighlight lang="julia">
ts = ((a, b) -> (c, d) -> a + b + c + d)(1,2);
</syntaxhighlight>
The call with arguments (1,2) returns a function.<br>
Then <code>ts</code> is equivalent to
<syntaxhighlight lang="julia">
ts = (c, d) -> 1 + 2 + c + d;
</syntaxhighlight>
You can also use the full <code>function(a,b)</code> syntax.


===Animation Loop===
===Animation Loop===