silo:std.collections.hashmap

Source src/silo:std.collections.hashmap

1##! HashMap — hash-based key-value collection.
2##!
3##! The `HashMap` type is implicitly available everywhere; this module
4##! attaches `.insert`, `.get`, `.contains`, and `.len` to it via host
5##! intrinsics.
6##!
7##! Not re-exported by the prelude — use
8##! `:use :open silo:std.collections.hashmap ...`.
9
10:use
11  :open core AnyInt Bool
12:end
13
14# si[impl coll.hashmap+1]
15:impl (HashMap key val)
16  .insert ( (HashMap key val) key val -> (HashMap key val) ) hashmap-insert-intrinsic ;
17  .get ( key (HashMap key val) -> val Bool ) hashmap-get-intrinsic ;
18  .contains ( key (HashMap key val) -> Bool ) hashmap-contains-intrinsic ;
19  .len ( (HashMap key val) -> AnyInt ) hashmap-len-intrinsic ;
20:end