Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

## Unreleased

## v0.8.0

* Additional helpers:
* Map - maps the items in the set and returns them as a new set
* MapTo - maps the items in the set into a provided set
* MapToSlice - maps the items in the set and returns them as a slice
* Filter - filters the items in the set based on the function and returns a new set
* Reduce - reduces the items in the set to a single value
* ReduceRight - reduces the items in the ordered set, in backwards order, to a single value
* ForEach - calls the provided function with each member of the set
* ForEachRight - calls the provided function for each item in the ordered set, in backwards order.
* Cleaned up some Examples so they now use New{Ordered,}With instead of New{Ordered,} and multiple Adds

## v0.7.1

* cmp.Diff examples

## v0.7.0

* Added `set.Pop() (M, bool)`, which returns and removes a random element from the set.
Expand Down
8 changes: 8 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ These helpers work on all Set types, including OrderedSets.
* `sets.Min(aSet)` : Returns the min element in the set as determined by the min builtin.
* `sets.Chunk(aSet,n)` : Chunks the set into n sets of equal size. The last set will have fewer elements if the cardinality of the set is not a multiple of n.
* `sets.IsEmpty(aSet)` : Returns true if the set is empty, otherwise false.
* `sets.Map(aSet, func(v V) X { return ... }) bSet` : Maps the elements of the set to a new set.
* `sets.MapTo(aSet, bSet, func(v V) X { return ... })` : Maps the elements of aSet into bSet.
* `sets.MapToSlice(aSet, func(v V) X { return ... }) aSlice` : Maps the elements of the set to a new slice.
* `sets.Filter(aSet, func(v V) bool { return true/false }) bSet` : Filters the elements of the set and returns a new set.
* `sets.Reduce(aSet, X, func(X, K) X { return ... }) X` : Reduces the set to a single value.
* `sets.ForEach(aSet, func(v V))` : calls the provided function with each set member.

## OrderedSet Helpers

Expand All @@ -80,6 +86,8 @@ These helpers work on all OrderedSet types.
* `sets.IsSorted(aOrderedSet)` : Returns true if the OrderedSet is sorted in ascending order.
* `sets.Reverse(aOrderedSet)` : Returns a new OrderedSet with the elements in the reverse order of the original OrderedSet.
* `sets.Sorted(aOrderedSet)` : Return a copy of aOrderedSet with the elements sorted in ascending order. Does not modify the original set.
* `sets.ReduceRight(aSet, X, func(X, K) X { return ... }) X` : Reduces the set to a single value in reverse order.
* `sets.ForEachRight(aSet, func(K) { ... })` : calls the provided function with each set member in reverse order.

## Custom Set Types

Expand Down
Loading
Loading