Documentation
¶
Overview ¶
Package hamt provides immutable collection types of maps (associative arrays) and sets implemented as Hash-Array Mapped Tries (HAMTs). All operations of the collections, such as insert and delete, are immutable and create new ones keeping original ones unmodified.
Index ¶
- type Entry
- type Map
- func (m Map) Delete(k Entry) Map
- func (m Map) Find(k Entry) interface{}
- func (m Map) FirstRest() (Entry, interface{}, Map)
- func (m Map) ForEach(cb func(Entry, interface{}) error) error
- func (m Map) Include(k Entry) bool
- func (m Map) Insert(k Entry, v interface{}) Map
- func (m Map) Merge(n Map) Map
- func (m Map) Size() int
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map represents a map (associative array).
func (Map) Find ¶
Find finds a value corresponding to a given key from a map. It returns nil if no value is found.
func (Map) FirstRest ¶
FirstRest returns a key-value pair in a map and a rest of the map. This method is useful for iteration. The key and value would be nil if the map is empty.
func (Map) Include ¶
Include returns true if a key-value pair corresponding with a given key is included in a map, or false otherwise.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set represents a set.
func (Set) FirstRest ¶
FirstRest returns a value in a set and a rest of the set. This method is useful for iteration.