Skip to content
Brandon Chisham edited this page Apr 29, 2024 · 1 revision

Collections

These are a set of interface templates and generic functions that implement these interfaces. Amounting to syntactic sugar for the common operations one does with respect to a collection. (ie traverse, filter, transform)

What this means for the end user is that one can write code like the following in a type safe way for any kind of slice.

list:= sequence.NewTransformer({}int{1, 2, 3, 4, 5}).TransformMust(strconv.Itoa) 

Using the error or context aware implementations one can impose timeouts, accommodate operations that might fail, etc.

From this base I plan to implement a stream type based on channels. From here I want to build (maybe as a separate project) a set of functional primitives that leverage these collections to encourage a functional style within go that also eliminates some of the boilerplate code one has to write.

Clone this wiki locally