belt icon indicating copy to clipboard operation
belt copied to clipboard

Composable iterators

Open strega-nil opened this issue 7 years ago • 4 comments

related to #20

strega-nil avatar Nov 20 '17 00:11 strega-nil

What I'd like to be able to do:

let arr =
  iter(arr)
  |> Iter.enumerate
  |> Iter.map(((n, x)) => x + n)
  |> Array.from_iter;

strega-nil avatar Nov 20 '17 01:11 strega-nil

https://github.com/rizo/iter/ seems to have a lot of what you need; I'm leery of interoperability with existing implementations and standard API but enough love and it should be workable

it would certainly be nice to see something closer to the core of the ecosystem, but it seems polished, and as I work more to leverage OPAM I'm finding this 'fragmentation' of community-developed tooling and libraries to be pretty pervasive, but the products to be extremely useful; the general feel is that the standard isn't moving fast enough or breaking enough things, so to compensate, people have adopted innovative features from other languages and invented new solutions, which I see as a reaffirmation of the power of the ML core and the fact that software developers are just humans taking care of their needs, with the werewithal to put some thought into maybe taking care of ours

truly inspiring to see a suite of tools as powerful as OCaml for abstraction over not-so-sexy things in not-so-sexy ways that actually has a pulse

kavorite avatar Nov 20 '17 06:11 kavorite

Ideally, this would work with both JS code and be truly functional at the same time. Not sure that’s possible, though – it’s a tall order.

rauschma avatar Nov 30 '17 22:11 rauschma

It'd be nice if there were some way to convert a JS object that has a well-implemented [Symbol.iterator] method and convert that into a well-typed value that is easy-to-use from ReasonML.

ckknight avatar Dec 01 '17 19:12 ckknight