RobinMalfait / lazy-collections

Collection of fast and lazy operations
MIT License
407 stars 24 forks source link

Add `toSet` feature #34

Closed RobinMalfait closed 1 year ago

RobinMalfait commented 1 year ago

This PR adds a new toSet feature.

Similar to the toArray feature, this one will create a new Set instead of an Array.

import { pipe, range, toSet } from 'lazy-collections'

let program = pipe(range(0, 10), toSet())

program()
// Set (11) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }