Silly me!  Thanks for catching the oversight.

[EMAIL PROTECTED] wrote:
> 
> - anyone want to make a /remove refinement ?
> 

================================================================
REBOL [
    Title: "Minimal Associative Data Store"
    File:  %assoc.r
    Date:  14-Sep-2000
    Author: "Joel Neely"
    Purpose: {
        Quick, minimal implementation of a data store that
        associates arbitrary values with (string!) keys.
    }
]

assoc: make object! [
    _keys: copy []
    _vals: copy []
    clear: func [] [_keys: copy []  _vals: copy []]
    clear?: func [] [empty? head _keys]
    count?: func [] [length? _keys]
    new: func [/local r] [r: make assoc []  r/clear  r]
    put: func [k [string!] v [any-type!] /local p] [
        either none? p: find _keys k [
            append _keys k
            append _vals v
        ][
            change at _vals index? p v
        ]
        v
    ]
    get: func [k [string!] /local p] [
        either none? p: find _keys k [
            none
        ][
            pick _vals index? p
        ]
    ]
    delete: func [k [string!] /local p v] [
        either none? p: find _keys k [
            none
        ][
            k: pick _vals p: index? p
            remove at _keys p
            remove at _vals p
            k
        ]
    ]
    keys: func [] [copy _keys]
]
================================================================
-- 
; Joel Neely  [EMAIL PROTECTED]  901-263-4460  38017/HKA/9677
REBOL []  print to-string debase/64 decompress #{
    789C0BCE0BAB4A7176CA48CAB53448740FABF474F3720BCC
    B6F4F574CFC888342AC949CE74B50500E1710C0C24000000}

Reply via email to