Anonymous user
Apply a callback to an array: Difference between revisions
m
→{{header|REXX}}: added DO-END labels, added comments, added whitespace. -- ~~~~
m (→{{header|REXX}}: added DO-END labels, added comments, added whitespace. -- ~~~~) |
|||
Line 1,517:
=={{header|REXX}}==
<lang rexx>/*REXX program to apply a callback to
a.=; b.=
a.0= 0
Line 1,534:
call bangit 'a','b' /*factorialize the A array, store results in B */
call listab ' after'
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────BANGIT subroutine───────────────────*/
bangit: do
_=value(arg(1)'.'
call value arg(2)'.'
end /*i*/
/*──────────────────────────────────FACT subroutine─────────────────────*/
fact: procedure; !=1; do j=2 to arg(1); !=!*j; end; return !
/*──────────────────────────────────LISTAB subroutine───────────────────*/
listab: do j=0 while a.j\==''; say arg(1) 'a.'j"="a.j; end /*j*/
say; do k=0 while b.k\==''; say arg(1) '
return</lang>
'''output'''
|