Currying: Difference between revisions
Content added Content deleted
(Better PHP example) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 42: | Line 42: | ||
REAL x = read real; |
REAL x = read real; |
||
print ((new line, sin (3 * x), 3 * sin (x) - 4 * (sin ** 3) (x)))</lang> |
print ((new line, sin (3 * x), 3 * sin (x) - 4 * (sin ** 3) (x)))</lang> |
||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |
||
Line 310: | Line 309: | ||
return 0 |
return 0 |
||
</lang> |
</lang> |
||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |
||
Line 482: | Line 479: | ||
--- Data stack: |
--- Data stack: |
||
{ 4 5 6 7 8 }</lang> |
{ 4 5 6 7 8 }</lang> |
||
⚫ | |||
⚫ | |||
⚫ | Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text ([http://wiki.formulae.org/Editing_F%C5%8Drmul%C3%A6_expressions more info]). Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation —i.e. XML, JSON— they are intended for transportation effects more than visualization and edition. |
||
⚫ | |||
=={{header|Forth}}== |
=={{header|Forth}}== |
||
Line 529: | Line 518: | ||
2 + 6 = 8 |
2 + 6 = 8 |
||
</pre> |
</pre> |
||
⚫ | |||
⚫ | |||
⚫ | Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text ([http://wiki.formulae.org/Editing_F%C5%8Drmul%C3%A6_expressions more info]). Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation —i.e. XML, JSON— they are intended for transportation effects more than visualization and edition. |
||
⚫ | |||
=={{header|Go}}== |
=={{header|Go}}== |
||
Line 1,168: | Line 1,165: | ||
Puzzle |
Puzzle |
||
</lang> |
</lang> |
||
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
||
Line 1,289: | Line 1,285: | ||
my $plusXOne = curry(\&plusXY, 1); |
my $plusXOne = curry(\&plusXY, 1); |
||
print &$plusXOne(3), "\n";</lang> |
print &$plusXOne(3), "\n";</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 1,600: | Line 1,589: | ||
((curried+ 3) 2) ; => 5 |
((curried+ 3) 2) ; => 5 |
||
</lang> |
</lang> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 1,688: | Line 1,685: | ||
var adder = curry(add, 1); |
var adder = curry(add, 1); |
||
say adder(3); #=>4</lang> |
say adder(3); #=>4</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Swift}}== |
=={{header|Swift}}== |
||
Line 1,709: | Line 1,721: | ||
println(add2) // (Function) |
println(add2) // (Function) |
||
println(add2(7)) // 9</lang> |
println(add2(7)) // 9</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Tcl}}== |
=={{header|Tcl}}== |