[REBOL] Re: Passing hash keys to functions
From: premshree::pillai::gmail::com at: 30-Dec-2004 1:27
On Wed, 29 Dec 2004 12:11:27 -0700, Gregg Irwin
<[greggirwin--mindspring--com]> wrote:
> 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]
> ]
Cool. I think I'm getting the hand of things. Thanks!
> 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
>
> --
> To unsubscribe from the list, just send an email to rebol-request
> at rebol.com with unsubscribe as the subject.
>
--
Premshree Pillai
http://www.livejournal.com/~premshree