tact
tact copied to clipboard
Nested maps
Tact could provide native support for nested maps with fixed arity of type like this:
m: map<(K1, K2, ... Kn), V>
To access a value, the user would need to provide a n-tuple of keys:
m.get(k1, k2, ..., kn): V?
and the same for .set, .exists, and .del.
With this feature it would make sense to support more key map types, not just Int and Address as we do now.
why do you call it "nested maps" if it's just a map with a key being tuple?
why do you call it "nested maps" if it's just a map with a key being tuple?
ah, this is because nested maps are like curried functions which are isomorphic to uncurried ones (the analogy isn't complete, though)
In many cases people actually want maps of arity more than 1, instead of "nested maps"
In many cases people actually want maps of arity more than 1, instead of "nested maps"
"n-key" maps can be a better term then, where regular ones are "1-key maps" (or "single-key maps")