/hcopy - Copy hash tables - 04/11/04 12:39 PM
i would like to see a command to copy an entire hash table.
i know it wouldn't benefit a lot of people, and it's easy to write such a script. but still maybe in a future version it could be implemented just for performance reasons.
until then here is the script i use right now to do the job if someone's interested.
i know it wouldn't benefit a lot of people, and it's easy to write such a script. but still maybe in a future version it could be implemented just for performance reasons.
until then here is the script i use right now to do the job if someone's interested.
Code:
alias hcopy { if ($1 == -s) { tokenize 32 $2- var %s = $true } if (!$hget($1)) { echo -s * /hcopy: no such table $+(',$1,') return } if ($hget($2)) hfree $2 hmake $2 $hget($1).size var %items = $hget($1,0).item, %item = 1, %it while (%item <= %items) { var %it = $hget($1,%item).item hadd $2 %it $hget($1,%it) inc %item } if (%s) echo -s * Hashtable $+(',$1,') copied to $+(',$2,') }