iter icon indicating copy to clipboard operation
iter copied to clipboard

does iter need of_seq

Open nilsbecker opened this issue 5 years ago • 4 comments

to allow conversion from the stdlib generator?

nilsbecker avatar Apr 27 '20 09:04 nilsbecker

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. :)

Drup avatar Apr 27 '20 10:04 Drup

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

c-cube avatar Apr 27 '20 13:04 c-cube

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.

Drup avatar Apr 27 '20 13:04 Drup

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 ?

nilsbecker avatar Apr 27 '20 20:04 nilsbecker