Anonymous user
Set consolidation: Difference between revisions
m
→{{header|REXX}}: added/changed whitespace and comments, made other cosmetic changes.
(Added EchoLisp) |
m (→{{header|REXX}}: added/changed whitespace and comments, made other cosmetic changes.) |
||
Line 1,464:
=={{header|REXX}}==
<lang rexx>/*REXX program demonstrates
@.=; @.1 = '{A,B} {C,D}'
do j=1 while
end /*j*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────ISIN
/*──────────────────────────────────SETCOMBINE subroutine─────────────────────*/
say ' the old sets=' space(bunch)▼
SETcombine: procedure; parse arg old,new; #=words(old) /*nullify NEW.*/
do k=1 for
end /*k*/ /* [↑] ··· and also remove the braces.*/
do until \changed; changed=0 /*consolidate some sets (well, maybe).*/
do set=1 for
do item=1 for words(
do other=set+1 to
if isIn(x,
iterate set
end
end /*other*/
end /*item */
end /*set */
end /*until
/* ╔╦══════════════════════════════════════════════════elide any duplicates.*/
do set=1 for
do items=1 for words(
if x==',' then iterate; if x=='' then leave
do until \isIn(x,
_=wordpos(x,
end /*until ¬isIn ··· */
end /*items*/
end /*set*/
do
end /*
say ' the new
return</lang>
▲/*──────────────────────────────────ISIN subroutine─────────────────────*/
▲{{out}} when using the default supplied sample sets:
<pre>
the old
the new
the old
the new
the old
the new
the old
the new
the old
the new
</pre>
|