I really like using lazy sequences when programming. They are often more comfortable, flexible, and fun to use than arrays. They are a very important data structure in many languages - see the F# Seq module, Enumerable in C#, OCaml Seq, iter tools in Rust, and Python itertools. There is a TC39 proposal to add some useful functions to JavaScript but until then there packages to fill the gap.
I’ve really missed having this functionality in ReScript. So I built a full-featured, well-tested, and documented library - the ReScript Seq module . There are nearly 100 useful functions. The links below will let you see a list of all the functions and see code samples to get a flavor for what you can do with it. I started from the OCaml source code (which somehow didn’t make it into Belt) but it uses a lot of recursion and caused stack overflows. So I adapted it. I researched tools from other languages/platforms and tried to incorporate the best stuff into a cohesive package.
Hope you like it and find it useful. This is part of my rescript-extras
package. I tried to break it out into its own thing but couldn’t due to circular references and am not too savvy with monorepos. But you can easily just use the Seq
module if that is all you care about.