[xquery-talk] Hashes

Brian Maso brian at blumenfeld-maso.com
Wed Sep 20 14:49:37 PDT 2006


How's about

define variable $animals as (
         <a>aardvark</a>,
         <b>bandicoot</b>,
         ...
)

(: and then later... :)
$animals/a

At 01:09 PM 9/20/2006, you wrote:
>Sometimes I wish that XQuery had hashes:
>
>Clunky XQuery 1.0 way:
>
>if ($n = "a") then "aardvark"
>else if ($n = "b") then "bandicoot"
>...
>else if ($n = "z") then "zebra"
>else ()
>
>Declunked way:
>
>define variable $animals as xqy:hash {
>   "a" => "aardvark", "b" => "bandicoot", ... , "z" => "zebra"
>}
>
>$animals[$n]
>
>
>
>Best
>
>Tim Finney
>
>
>_______________________________________________
>talk at x-query.com
>http://x-query.com/mailman/listinfo/talk




More information about the talk mailing list