Jump to content

Function composition: Difference between revisions

add FreeBASIC
m (→‎{{header|Phix}}: added syntax colouring the hard way)
(add FreeBASIC)
Line 1,117:
 
Should you need to, you could also mix both methods by overloading the COMPOSE operator.
 
=={{header|FreeBASIC}}==
Illustrating with functions that take and return integers.
<lang freebasic>function compose( f as function(as integer) as integer,_
g as function(as integer) as integer,_
n as integer ) as integer
return f(g(n))
end function</lang>
If you have functions named, say, foo and bar you would call compose with
<pre>compose( @foo, @bar, n )</pre> for some integer n.
 
=={{header|FunL}}==
781

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.