First-class functions: Difference between revisions
Added output example
(Added BBC BASIC) |
Keithpinson (talk | contribs) (Added output example) |
||
Line 1,372:
=={{header|Scala}}==
<lang scala>import math._▼
▲import math._
// functions as values
Line 1,391 ⟶ 1,389:
// output results of applying the functions
comp foreach {f =>
Output:
<pre>0.5 0.4999999999999999 0.5000000000000001</pre>
<!--
Here's how you could add a composition operator to make that syntax prettier:
Line 1,401:
// now functions can be composed thus
println((cube o cube o cuberoot)(0.5)) </lang>-->
=={{header|Scheme}}==
|