Topswops: Difference between revisions

m
→‎{{header|REXX}}: optimized a subroutine.
m (→‎{{header|REXX}}: changed some comments and whitespace.)
m (→‎{{header|REXX}}: optimized a subroutine.)
Line 1,838:
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
 
swops: parse arg z; do u=1; parse var z t .; if length(t)==2 then t=x2d(t)
swops: parse arg z; do u=1; parse var z t .; if word\datatype(zt, t'W')==1 then return u /*found unity at T. */t=x2d(t)
if word(z, t)==1 then return u do h=10 to things; if/*found pos(h,unity z)==0at thenT. iterate*/
do zh=changestr(h,10 z, d2x(h)to )things; if pos(h, z)==0 /* [↑] any H's inthen Z?*/iterate
z=changestr(h, z, d2x(h) ) end /*h [↑] any H's in Z?*/
z=reverse( subword(z, 1, t) ) end subword(z, t + 1)/*h*/
z=reverse( endsubword(z, 1, t) /*u*/</lang>) subword(z, t + 1)
end /*u*/</lang>
Some older REXXes don't have a '''changestr''' bif, so one is included here &nbsp; ───► &nbsp; [[CHANGESTR.REX]].