Anonymous user
Higher-order functions: Difference between revisions
m
→{{header|REXX}}: added a comment, aligned some statements, added whitespace, re-did subroutine fence. -- ~~~~
Capra Hircus (talk | contribs) (adding maxima) |
m (→{{header|REXX}}: added a comment, aligned some statements, added whitespace, re-did subroutine fence. -- ~~~~) |
||
Line 1,625:
=={{header|REXX}}==
<lang rexx>/*REXX program
n=3735928559
funcName='fib' ; q= 10; call someFunction funcName,q; call tell
Line 1,633:
funcName='reverse'; q=721; call someFunction funcName,q; call tell
say '~~~~~~~~~'
say 'done as' d2x(n)"."
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────subroutines─────────────────────────*/
someFunction: procedure; arg whatwhat,n; signal value (whatwhat)
say result 'result'
return
cube: return n**3
square: return n**2
reverse: return 'REVERSE'(n)
fact: !=1; do j=2 to n; !=!*j; end; return !
tell: say right(funcName'('q") = ",20)result; return
fib: if n==0 then return n; if n==1 then return n; _=0; a=0; b=1
'''output'''
<pre style="overflow:scroll">
|