Koazee is a StreamLike, Immutable, Lazy Loading and smart Golang Library to deal with slices.

Koazee v0.0.3 (Gibbon)

Highlights

  • Immutable: Koazee won’t modify your inputs.
  • StreamLike: We can combine operations up our convenience.
  • Lazy loading: Operations are not performed until they’re required
  • Generic: Koazee provides a generic interface able to deal with slice of any type without creating custom functions.
  • Focusing on performance: First rule for implementing a new operation is providing the best possible performance.

Stream creation

Let’s first obtain a stream from an existing array.

Stream operations

Release Gibbon brings us 20 generic operations that are showed below

  • stream.At / stream.First / stream.Last: These operations return an element from the stream
  • stream.Add / stream.Drop / stream.DeleteAt / stream.Pop / stream.Set: These operations add or delete elements from the stream.
  • stream.Count / stream.IndexOf / stream.LastIndexOf / stream.Contains: These operations return info from the elements in the stream
  • stream.Sort / stream.Reverse: These operations organize the elements in the stream.
  • stream.Take / stream.Filter / stream.RemoveDuplicates: These operations return a filtered stream.
  • stream.Map: This operation performs a modification over all the elements in the stream.
  • stream.Reduce: This operation give us a single output after iterating over the elements in the stream.
  • stream.ForEach: This operation iterates over the element in the stream

Combine operations and evaluate them lazily

The main goal of Koazee is providing a set of operations that can be combined and being evaluated lazily.


And… what’s about performance?

Operations provide benchmark tests to demonstrate how Koazee is your best choice. You could find more info in article: Koazee vs Go-Funk vs Go-Linq


New operations on roadmap ?

For sure, this is only the beginning! By the way, If you missed any operation in Koazee v0.0.3, or you found a bug, please create a new issue on Github or vote the existing ones!

Links of interest

wesovilabs

wesovilabs articles

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade