Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Hash-from-two-arrays/REXX/hash-from-two-arrays.rexx
Normal file
23
Task/Hash-from-two-arrays/REXX/hash-from-two-arrays.rexx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*REXX program demonstrates hashing of a stemmed array (from a key or multiple keys)*/
|
||||
key.= /*names of the nine regular polygons. */
|
||||
vals= 'triangle quadrilateral pentagon hexagon heptagon octagon nonagon decagon dodecagon'
|
||||
key.1='thuhree vour phive sicks zeaven ate nein den duzun'
|
||||
key.2='three four five six seven eight nine ten twelve'
|
||||
key.3='3 4 5 6 7 8 9 10 12'
|
||||
key.4='III IV V VI VII VIII IX X XII'
|
||||
key.5='iii iv v vi vii viii ix x xii'
|
||||
hash.='───(not defined)───' /* [↑] blanks added to humorous keys */
|
||||
/* just because it looks prettier.*/
|
||||
do k=1 while key.k\==''
|
||||
call hash vals,key.k /*hash the keys to the values. */
|
||||
end /*k*/
|
||||
|
||||
parse arg query . /*obtain what was specified on the C.L.*/
|
||||
if query\=='' then say 'key:' left(query,40) "value:" hash.query
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
hash: parse arg @val,@key
|
||||
do j=1 for words(@key); map= word(@key, j)
|
||||
hash.map= word(@val, j)
|
||||
end /*j*/
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue