Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Essay on Associative Data Stores

From: g:santilli:tiscalinet:it at: 18-Sep-2000 19:21

Hello [joel--neely--fedex--com]! On 16-Set-00, you wrote: j>>> test-select: func [b [block!] k [any-type!] v j> [any-type!]] [ j> [ append b reduce [k v] j> [ select b k j> [ ] j>>> blk: [] j> == [] Try this:
>> test-select: func [b k v] [
[ append b reduce [k v] [ select/only b k [ ]
>> blk: []
== []
>> test-select blk "a" "b"
== "b"
>> test-select blk [2 3] 6
== 6 j>>> select blk reduce [[2 3]] j> == 6 j> Now THAT was a surprise! I'll be glad to hear any explanations j> anyone can offer for that last case! Whatever the explantion REBOL functions tend to treat series as a sequence of values, not as a single value. They have the /ONLY refinement to treat series as a single value. You SELECT was serching for the value 2 followed by the value 3, not for the value [2 3]. Also notice that:
>> blk: [1 2 "one-two" 1 3 "one-three" 2 3 "two-three"]
== [1 2 "one-two" 1 3 "one-three" 2 3 "two-three"]
>> select blk [1 2]
== "one-two"
>> select blk [1 3]
== "one-three"
>> select blk [2 3]
== "two-three" Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/