Skip to content

Frixuu/LazyLambda

Repository files navigation

Logo
LazyLambda

Functional iterators library for Haxe 4.2 and later.

License Lint status Build status Code coverage %

How to use

using lazylambda.Prelude;
array.iterator()
    .take(10)
    .filter(i -> i < 100)
    .map(i -> Std.string(i + 1))
    .join(", ");

How does it compare to…

  • Lambda, from the standard library: It's in the name. While the standard library functions are eager, that is resolve immediately, LazyLambda only processes the iterators when their items are needed. This approach can be sometimes noticably faster. (Plus, I'm not a fan of its function naming schemes.)
  • yar3333/stdlib: This is a general-purpose library, so it's not a one-to-one comparison, but its facilities seem focused on Arrays specifically instead of iterators in general.
  • SomeRanDev/MagicArrayTools: It's magic! No, literally. If all you need is for your app to be as performant as possible, you won't go wrong with this library. That being said, it's basically one giant macro, and macros tend to have their quirks and special handling requirements. Its code may also be difficult to grasp when wanting to extend it.
  • LPeter1997/itertools: This one is the most similar as it tries to reach exactly the same design goals, BUT it fails, in my opinion, in a one crucial way: its function signatures. They consume and produce Iterables instead of Iterators. This approach needlesly allocates extra wrappers, closures, and generally makes it harder for the compiler to optimize away.

About

Functional iterators for Haxe 4.2+.

Topics

Resources

License

Stars

Watchers

Forks

Languages