nub package:streamly-core

Used as a scan. Returns Just for the first occurrence of an element, returns Nothing for any other occurrences. Example:
>>> stream = Stream.fromList [1::Int,1,2,3,4,4,5,1,5,7]
> Stream.toList $ Stream.scanMaybe Fold.nub stream
  • 1,2,3,4,5,7
Pre-release
Returns Just for the first occurrence of an element, returns Nothing for any other occurrences. Example:
>>> stream = Stream.fromList [1::Int,1,2,3,4,4,5,1,5,7]

>>> Stream.toList $ Stream.postscanlMaybe Scanl.nub stream
[1,2,3,4,5,7]
Pre-release
Like nub but specialized to a stream of Int, for better performance. Pre-release
Like nub but specialized to a stream of Int, for better performance. Pre-release
nub specialized to Ord types for better performance. Returns a subsequence of the stream removing any duplicate elements. The memory used is proportional to the number of unique elements in the stream. One way to limit the memory is to use take on the resulting stream to limit the unique elements in the stream.