2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,15 +1,16 @@
/*REXX program finds palindrome pairs using a dictionary (UNIXDICT.TXT).*/
#=0 /*# palindromes (so far)*/
parse arg iFID .; if iFID=='' then iFID='UNIXDICT.TXT' /*use default?*/
@.= /*caseless no-duped word*/
do while lines(iFID)\==0; _=space(linein(iFID),0); parse upper var _ u
if length(_)<2 | @.u\=='' then iterate /*can't be a unique pal.*/
r=reverse(u) /*get the reverse of U. */
if @.r\=='' then do; #=#+1 /*found palindrome pair?*/
if #<6 then say @.r',' _ /*only list first 5 pals*/
end /* [↑] bump count, show*/
@.u=_ /*define palindromic pal*/
end /*while*/ /* [↑] read dictionary.*/
/*REXX program finds palindrome pairs in a dictionary (the default is UNIXDICT.TXT). */
#=0 /*number palindromes (so far).*/
parse arg iFID .; if iFID=='' then iFID='UNIXDICT.TXT' /*Not specified? Use default.*/
@.= /*uppercase no─duplicated word*/
do while lines(iFID)\==0; _=space(linein(iFID),0) /*read a word from dictionary.*/
parse upper var _ u /*obtain an uppercase version.*/
if length(_)<2 | @.u\=='' then iterate /*can't be a unique palindrome*/
r=reverse(u) /*get the reverse of the word.*/
if @.r\=='' then do; #=#+1 /*find a palindrome pair ? */
if #<6 then say @.r',' _ /*just show 1st 5 palindromes.*/
end /* [↑] bump palindrome count.*/
@.u=_ /*define a unique palindrome. */
end /*while*/ /* [↑] read the dictionary. */
say
say "There're" # 'unique palindrome pairs in the dictionary file: ' iFID
/*stick a fork in it, we're done.*/
say "There're " # ' unique palindrome pairs in the dictionary file: ' iFID
/*stick a fork in it, we're done. */