Apply a callback to an array: Difference between revisions

Content added Content deleted
(Moved the REXX language to it's proper place alphabetically. -- ~~~~)
m (→‎{{header|REXX}}: removed superflous blanks, made REXX code compliant.. -- ~~~~)
Line 1,404: Line 1,404:


=={{header|REXX}}==
=={{header|REXX}}==
<lang rexx>/*REXX program to apply a callback to an array. */
<lang rexx>
a.=''; b.=''
a.=; b.=
a.0= 0
a.0= 0
a.1= 1
a.1= 1
Line 1,422: Line 1,422:
call listab ' after'
call listab ' after'
exit
exit

/*─────────────────────────────────────BANGIT subroutine────────────────*/
/*─────────────────────────────────────BANGIT subroutine────────────────*/
bangit: do j=0
bangit: do j=0
Line 1,428: Line 1,427:
call value arg(2)'.'j,fact(_)
call value arg(2)'.'j,fact(_)
end
end

/*─────────────────────────────────────FACT subroutine──────────────────*/
/*─────────────────────────────────────FACT subroutine──────────────────*/
fact: procedure; !=1; do j=2 to arg(1); !=!*j; end; return !
fact: procedure; !=1; do j=2 to arg(1); !=!*j; end; return !



/*─────────────────────────────────────LISTAB subroutine────────────────*/
/*─────────────────────────────────────LISTAB subroutine────────────────*/
Line 1,441: Line 1,438:
say arg(1) 'b.'j"="b.j
say arg(1) 'b.'j"="b.j
end
end
return
return</lang>
'''output'''
</lang>
Output:
<pre style="height:30ex;overflow:scroll">
<pre style="height:30ex;overflow:scroll">
before a.0=0
before a.0=0