c-cube / iter

Simple iterator abstract datatype, intended to iterate efficiently on collections while performing some transformations.
https://c-cube.github.io/iter
BSD 2-Clause "Simplified" License
119 stars 11 forks source link

does iter need of_seq #30

Open nilsbecker opened 4 years ago

nilsbecker commented 4 years ago

to allow conversion from the stdlib generator?

Drup commented 4 years ago

Well, sure, but you need inversion of control (like algebraic effects or delimcc) to write such a function, and it's terribly slow.

It's one of those function that, when you need it, you probably should figure out a way not to. :)

c-cube commented 4 years ago

of_seq is easy, it's to_seq that'd be hard.

Drup commented 4 years ago

Oh, I misread! Yes, of_seq is easy and pretty useful, I suppose. Although in most cases it's better to cut off the middlemen.

nilsbecker commented 4 years ago

hm. in the current context i was using gen and Iter.of_gen before and was moving from gen to Stdlib.Seq. i then noticed that there is no equivalent of_seq. in the meantime i figured out how to do it with OSeq.iter. i did not really think about efficiency at all at the moment. am i doing it wrong^TM ?