tcbrindle / flux

A C++20 library for sequence-orientated programming
https://tristanbrindle.com/flux/
Boost Software License 1.0
476 stars 29 forks source link

Odd location of `iota` #90

Closed brycelelbach closed 1 year ago

brycelelbach commented 1 year ago

Why is iota hidden in <flux/source/*>? Other views are in <flux/op/*>.

tcbrindle commented 1 year ago

The types in the source directory are "sequence factories" -- things that (only) go at the start of a Flux pipeline, that is, the "source" of some data. iota is one of those, along with things like from_range, single, empty, istream etc.

The op directory is for adaptors (things that go in the middle of a pipeline and return a lazily evaluated sequence, like filter, map or chunk) and for algorithms (things that go at the end of a pipeline and either return a value or modify a sequence in-place, like sum, fold or sort).

Admittedly this distinction is fairly arbitrary, but hopefully that makes sense!