First-class functions: Difference between revisions

Added output example
(Added BBC BASIC)
(Added output example)
Line 1,372:
 
=={{header|Scala}}==
<lang scala>import math._
{{incomplete|Scala|Fails to demonstrate that the result of applying the composition of each function in A and its inverse in B to a value, is the original value}}
<lang scala>
import math._
 
// functions as values
Line 1,391 ⟶ 1,389:
 
// output results of applying the functions
comp foreach {f => printlnprint(f(0.5) + " ")}</lang>
Output:
</lang>
<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}}==
105

edits