[REBOL] Re: Passing hash keys to functions
From: greggirwin:mindspring at: 29-Dec-2004 12:11
PP> This was what I was using initially. But I need to use this within a
PP> function, and the key is taken as an argument, so I cannot use this
PP> method. Or can I?
Sure you can. And you can use a lot of datatypes for keys. You don't
want to use numbers (integer! and decimal!) because those will be
interpreted as positions (e.g. for use with PICK), not keys.
my-select: func [series [series!] key] [
attempt [series/:key]
]
hash-ser: make hash! [<a> [1 2] <b> [3 4]]
hash-ser/<a>
my-select hash-ser <a>
series: [#"z" $2.2 3x3 a <b> #c %file-d [name--host--dom] http://www.test.url #"z"]
foreach key series [
print [key tab series/:key]
]
-- Gregg