September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -3,10 +3,9 @@ $= '2 3 5 7 11 13 17 19 cats 222 -100.2 +11 1.1 +7 7. 7 5 5 3 2 0 4.4 2' /*it
say 'original list:' $
say right( words($), 17, '') 'words in the original list.'
z=; @.= /*initialize the NEW list & index list.*/
do j=1 for words($); y=word($,j) /*process the words (items) in the list*/
if @.y=='' then z=z y; @.y=. /*Not duplicated? Add to Z list,@ array*/
do j=1 for words($); y= word($, j) /*process the words (items) in the list*/
if @.y=='' then z= z y; @.y= . /*Not duplicated? Add to Z list,@ array*/
end /*j*/
say
say 'modified list:' space(z)
say 'modified list:' space(z) /*stick a fork in it, we're all done. */
say right( words(z), 17, '') 'words in the modified list.'
/*stick a fork in it, we're all done. */

View file

@ -2,11 +2,10 @@
$= '2 3 5 7 11 13 17 19 cats 222 -100.2 +11 1.1 +7 7. 7 5 5 3 2 0 4.4 2' /*item list.*/
say 'original list:' $
say right( words($), 17, '') 'words in the original list.'
#=words($) /*process all the words in the list. */
do j=# by -1 for #; y=word($, j) /*get right-to-Left. */
_=wordpos(y, $, j + 1); if _\==0 then $=delword($,_,1) /*Dup? Then delete it*/
end /*j*/
#= words($) /*process all the words in the list. */
do j=# by -1 for #; y= word($, j) /*get right-to-Left. */
_= wordpos(y, $, j + 1); if _\==0 then $= delword($, _, 1) /*Dup? Then delete it*/
end /*j*/
say
say 'modified list:' space($)
say 'modified list:' space($) /*stick a fork in it, we're all done. */
say right( words(z), 17, '') 'words in the modified list.'
/*stick a fork in it, we're all done. */

View file

@ -1,12 +1,11 @@
/*REXX program removes any duplicate elements (items) that are in a list (using 2 lists)*/
old = '2 3 5 7 11 13 17 19 cats 222 -100.2 +11 1.1 +7 7. 7 5 5 3 2 0 4.4 2'
say 'original list:' old
say right( words(old), 17, '') 'words in the original list.'
say right( words(old), 17, '') 'words in the original list.'
new= /*start with a clean (list) slate. */
do j=1 for words(old); _=word(old, j) /*process the words in the OLD list. */
if wordpos(_,new)==0 then new=new _ /*Doesn't exist? Then add word to NEW.*/
end /*j*/
do j=1 for words(old); _= word(old, j) /*process the words in the OLD list. */
if wordpos(_, new)==0 then new= new _ /*Doesn't exist? Then add word to NEW.*/
end /*j*/
say
say 'modified list:' space(new)
say right( words(new), 17, '') 'words in the modified list.'
/*stick a fork in it, we're all done. */
say 'modified list:' space(new) /*stick a fork in it, we're all done. */
say right( words(new), 17, '') 'words in the modified list.'