by hartrock » Thu Jul 02, 2015 1:14 am
Thanks for clearifying the difference between symbols and Tree or (ctxt "someKey") hashmap values.
My usecase is a state machine modeled by a hash map with string state IDs as keys, where I want to count state changes. So I have two Tree hash maps: one for the states, another for the counters; both with same string keys.
Best solution I think is to init the corresponding counter hash map val with 0, just with adding a new state to state machine hashmap (which will be done by a func); so above check for nil can be omitted.
Using symbol keys for states like sm:someState would be possible, too; but then there could be a conflict with funcs like sm:add-state, located in same context as state hashmap.
Last edited by
hartrock on Thu Jul 02, 2015 1:35 am, edited 1 time in total.