DictionaryCore

By Andrew Owen
Released under the MIT license

Notes:

Words for manipulating dictionaries

<dict> ( -- dict )

Place an empty dictionary on the stack

dict-has-key? ( dict key -- has-key? )

Check to see if a dictionary has a given key

dict-set ( dict value key -- )

Set the entry in dict at key to value

dict-push ( dict value key -- dict )

Set the entry in dict at key to value, leaving the dict on the stack

dict-get ( dict key -- value|error? )

Get the key, or error if it doesn't exist

dict-keys ( dict -- { keys } )

Loads all the keys for a dictionary into an array

dict-get-rand ( dict -- key value )

Get a random key/value pair from this dictionary

dict-each-key (dict quot -- .. )

Run a function over each key in the dictionary

dict-if-empty-stack ( .. -- dict? )

dict-if-not-dict ( .. -- dict )

ensure-dictionary ( .. -- dict )

get-or-default ( dict key default -- value )

prefix: -> ( dict key -- val )

prefix: ->> ( :dict :key -- val dict )

prefix: <<- ( dict val key -- dict )

prefix: <- ( dict val key -- )

prefix: ->$ ( dict key -- )

prefix: ->>$ ( dict key -- dict )

prefix: <-$ ( dict varname -- )

prefix: <<-$ ( dict varname -- )

prefix: $<- ( dict val key -- )

prefix: $<<- ( dict val key -- dict )

prefix: -% ( dict? key -- dict )

prefix: ->? ( dict key -- dict ? )

prefix: . ( dict key -- .. )