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,5 +1,5 @@
/*REXX program searches a collection of strings. */
hay.= /*initialize haystack collection.*/
/*REXX program searches a collection of strings (an array of periodic table elements).*/
hay.= /*initialize the haystack collection. */
hay.1 = 'sodium'
hay.2 = 'phosphorous'
hay.3 = 'californium'
@ -13,18 +13,17 @@ hay.10 = 'copper'
hay.11 = 'helium'
hay.12 = 'sulfur'
needle='gold' /*we'll be looking for the gold. */
upper needle /*in case some people capitalize.*/
found=0 /*assume needle isn't found yet. */
needle = 'gold' /*we'll be looking for the gold. */
upper needle /*in case some people capitalize stuff.*/
found=0 /*assume the needle isn't found yet. */
do j=1 while hay.j\=='' /*keep looking in haystack. */
_=hay.j; upper _ /*make it uppercase to be safe. */
if _=needle then do /*we've found needle in haystack.*/
found=1 /*indicate that needle was found,*/
leave /* and stop looking, of course. */
do j=1 while hay.j\=='' /*keep looking in the haystack. */
_=hay.j; upper _ /*make it uppercase to be safe. */
if _=needle then do; found=1 /*we've found the needle in haystack. */
leave /* ··· and stop looking, of course. */
end
end /*j*/
if found then return j /*return haystack index number. */
if found then return j /*return the haystack index number. */
else say needle "wasn't found in the haystack!"
return 0 /*indicates needle wasn't found. */
return 0 /*indicates the needle wasn't found. */

View file

@ -1,6 +1,6 @@
/*REXX program searches a collection of strings. */
hay.0=1000 /*safely indicate highest item #.*/
hay.200 = 'binilnilium'
/*REXX program searches a collection of strings (an array of periodic table elements).*/
hay.0 = 1000 /*safely indicate highest item number. */
hay.200 = 'Binilnilium'
hay.98 = 'californium'
hay.6 = 'carbon'
hay.112 = 'copernicium'
@ -17,28 +17,18 @@ hay.11 = 'sodium'
hay.16 = 'sulfur'
hay.81 = 'thallium'
hay.92 = 'uranium'
/* [↑] sorted by the element name. */
needle = 'gold' /*we'll be looking for the gold. */
upper needle /*in case some people capitalize. */
found=0 /*assume the needle isn't found (yet).*/
needle = 'gold' /*we'll be looking for the gold. */
upper needle /*in case some people capitalize.*/
found=0 /*assume needle isn't found, yet.*/
do j=1 for hay.0 /*start looking in haystack item1*/
_=hay.j; upper _ /*make it uppercase to be safe. */
if _=needle then do /*we've found needle in haystack.*/
found=1 /*indicate that needle was found,*/
leave /* and stop looking, of course. */
do j=1 for hay.0 /*start looking in haystack, item 1. */
_=hay.j; upper _ /*make it uppercase just to be safe. */
if _=needle then do; found=1 /*we've found the needle in haystack. */
leave /* ··· and stop looking, of course. */
end
end /*j*/
if found then return j /*return haystack index number. */
if found then return j /*return the haystack index number. */
else say needle "wasn't found in the haystack!"
return 0 /*indicates needle wasn't found. */
/*─────────────────────────────────────────────── incidentally, to find */
/* the number of haystack items: */
hayItems=0
do k=1 for hay.0 /*find item AFTER the last item.*/
if hay.k\=='' then hayItems=hayItems+1 /*bump the item counter.*/
end /*k*/
/*stick a fork in it, we're done.*/
return 0 /*indicates the needle wasn't found. */

View file

@ -1,29 +1,29 @@
/*REXX program searches a collection of strings. */
hay.=0 /*initialize haystack collection.*/
hay._sodium = 1
hay._phosphorous = 1
hay._califonium = 1
hay._copernicium = 1
hay._gold = 1
hay._thallium = 1
hay._carbon = 1
hay._silver = 1
hay._copper = 1
hay._helium = 1
hay._sulfur = 1
/*underscores (_) are used to NOT*/
/* conflict with variable names.*/
/*REXX program searches a collection of strings (an array of periodic table elements).*/
hay.=0 /*initialize the haystack collection. */
hay._sodium = 1
hay._phosphorous = 1
hay._californium = 1
hay._copernicium = 1
hay._gold = 1
hay._thallium = 1
hay._carbon = 1
hay._silver = 1
hay._copper = 1
hay._helium = 1
hay._sulfur = 1
/*underscores (_) are used to NOT ... */
/* ... conflict with variable names. */
needle = 'gold' /*we'll be looking for the gold. */
needle = 'gold' /*we'll be looking for the gold. */
Xneedle = '_'needle /*prefix an underscore (_) char. */
upper Xneedle /*uppercase: how REXX stores 'em.*/
Xneedle = '_'needle /*prefix an underscore (_) character. */
upper Xneedle /*uppercase: how REXX stores them. */
/*alternative version of above, */
/* Xneedle=translate('_'needle)*/
/*alternative version of above: */
/* Xneedle=translate('_'needle) */
found=hay.Xneedle /*this is it, it's found or not.*/
found=hay.Xneedle /*this is it, it's found (or maybe not)*/
if found then return j /*return haystack index number. */
if found then return j /*return the haystack index number. */
else say needle "wasn't found in the haystack!"
return 0 /*indicates needle wasn't found. */
return 0 /*indicates the needle wasn't found. */

View file

@ -1,24 +1,21 @@
/*REXX program searches a collection of strings. */
/*REXX program searches a collection of strings (an array of periodic table elements).*/
haystack=, /*names of the first 200 elements of the periodic table*/
'hydrogen helium lithium berylliumbon nitrogen oxygen fluorine neon sodium magnesium aluminum silicon phosphorous sulfur chlorine argon potassium calcium scandium titanium',
'vanadium chromium manganese iron kel copper zinc gallium germanium arsenic selenium bromine krypton rubidium strontium yttrium zirconium niobium molybdenum technetium ruthenium',
'rhodium palladium silver cadmium antimony tellurium iodine xenon cesium barium lanthanum cerium praseodymium neodymium promethium samarium europium gadolinium terbium dysprosium',
'holmium erbium thulium ytterbium afnium tantalum tungsten rhenium osmium irdium platinum gold mercury thallium lead bismuth polonium astatine radon francium radium actinium',
'thorium protactinium uranium neptonium americium curium berkelium californium einsteinum fermium mendelevium nobelium lawrencium rutherfordium dubnium seaborgium bohrium hassium',
'meitnerium darmstadtium roentgenicium ununtrium flerovium ununpentium livermorium ununseptium ununoctium ununennium unbinilium unbiunium unbibium unbitrium unbiquadium',
'unbipentium unbihexium unbiseptiuum unbiennium untrinilium untriunium untribium untritrium untriquadium untripentium untrihexium untriseptium untrioctium untriennium unquadnilium',
'unquadunium unquadbium unquadtriuadium unquadpentium unquadhexium unquadseptium unquadoctium unquadennium unpentnilium unpentunium unpentbium unpenttrium unpentquadium',
'unpentpentium unpenthexium unpentpentoctium unpentennium unhexnilium unhexunium unhexbium unhextrium unhexquadium unhexpentium unhexhexium unhexseptium unhexoctium unhexennium',
'unseptnilium unseptunium unseptbirium unseptquadium unseptpentium unsepthexium unseptseptium unseptoctium unseptennium unoctnilium unoctunium unoctbium unocttrium unoctquadium',
'unoctpentium unocthexium unoctsepoctium unoctennium unennilium unennunium unennbium unenntrium unennquadium unennpentium unennhexium unennseptium unennoctium unennennium binilnilium'
haystack=, /*names of the first 200 elements of the periodic table*/
'hydrogen helium lithium beryllium boron carbon nitrogen oxygen fluorine neon sodium magnesium aluminum silicon phosphorous sulfur chlorine argon potassium calcium scandium titanium',
'vanadium chromium manganese iron cobalt nickel copper zinc gallium germanium arsenic selenium bromine krypton rubidium strontium yttrium zirconium niobium molybdenum technetium ruthenium',
'rhodium palladium silver cadmium indium tin antimony tellurium iodine xenon cesium barium lanthanum cerium praseodymium neodymium promethium samarium europium gadolinium terbium dysprosium',
'holmium erbium thulium ytterbium lutetium hafnium tantalum tungsten rhenium osmium iridium platinum gold mercury thallium lead bismuth polonium astatine radon francium radium actinium',
'thorium protactinium uranium neptunium plutonium americium curium berkelium californium einsteinium fermium mendelevium nobelium lawrencium rutherfordium dubnium seaborgium bohrium hassium',
'meitnerium darmstadtium roentgenium copernicium Ununtrium flerovium Ununpentium livermorium Ununseptium Ununoctium Ununennium Unbinilium Unbiunium Unbibium Unbitrium Unbiquadium',
'Unbipentium Unbihexium Unbiseptium Unbioctium Unbiennium Untrinilium Untriunium Untribium Untritrium Untriquadium Untripentium Untrihexium Untriseptium Untrioctium Untriennium Unquadnilium',
'Unquadunium Unquadbium Unquadtrium Unquadquadium Unquadpentium Unquadhexium Unquadseptium Unquadoctium Unquadennium Unpentnilium Unpentunium Unpentbium Unpenttrium Unpentquadium',
'Unpentpentium Unpenthexium Unpentseptium Unpentoctium Unpentennium Unhexnilium Unhexunium Unhexbium Unhextrium Unhexquadium Unhexpentium Unhexhexium Unhexseptium Unhexoctium Unhexennium',
'Unseptnilium Unseptunium Unseptbium Unsepttrium Unseptquadium Unseptpentium Unsepthexium Unseptseptium Unseptoctium Unseptennium Unoctnilium Unoctunium Niobium Unocttrium Unoctquadium',
'Unoctpentium Unocthexium Unoctseptium Unoctoctium Unoctennium Unennilium Unennunium Unennbium Unenntrium Unennquadium Unennpentium Unennhexium Unennseptium Unennoctium Unennennium Binilnilium'
needle = 'gold' /*we'll be looking for the gold. */
upper needle haystack /*in case some people capitalize.*/
idx=wordpos(needle,haystack) /*use REXX's bif: WORDPOS */
/* bif: built-in function.*/
if idx\==0 then return idx /*return haystack index number. */
needle = 'gold' /*we'll be looking for the gold. */
upper needle haystack /*in case some people capitalize stuff. */
idx=wordpos(needle,haystack) /*use REXX's BIF: WORDPOS */
if idx\==0 then return idx /*return the haystack index number. */
else say needle "wasn't found in the haystack!"
return 0 /*indicates needle wasn't found. */
return 0 /*indicates the needle wasn't found. */