Anonymous user
Partial function application: Difference between revisions
m
→{{header|REXX}}: added/changed whitespace and comments, removed a fence comment.
m (→{{header|REXX}}: added/changed whitespace and comments, removed a fence comment.) |
|||
Line 1,497:
=={{header|REXX}}==
<lang rexx>/*REXX program demonstrates a method of a partial function application. */
s=; do a=0 to 3 /*build 1st series
s=strip(s a) /*append to the integer to the S list*/
end /*a*/
call fs 'f1',s; say 'for f1: series=' s", result=" result
call fs 'f2',s; say 'for f2: series=' s", result=" result
s=; do b=2 to 8 by 2 /*build 2nd series, low even
s=strip(s b) /*append to the integer to the S list*/
end /*b*/
call fs 'f1',s; say 'for f1: series=' s", result=" result
call fs 'f2',s; say 'for f2: series=' s", result=" result
exit /*stick a fork in it, we're all done. */
/*────────────────────────────────────────────────────────────────────────────*/
f1: return arg(1)* 2
f2: return arg(1)**2
/*────────────────────────────────────────────────────────────────────────────*/
fs: procedure; arg f,s; $=;
interpret '$=$' f"("z')'
end /*j*/
return strip($)</lang>
'''output'''
<pre>
|