flow-mumu-0.1.6 has been yanked.
Lava Flow | Streaming & transforms for Lava
Streaming flow and Functional Transformation for Lava/Mumu scripts
- GitLab: https://gitlab.com/tofo/mumu-flow
- Crates.io: https://crates.io/crates/mumu-flow
- Author: Tom Fotheringham & contributors
- License: MIT | Apache-2.0
This plugin adds JSSON (stream) tools (Functional, Partial, Underscore Parial) to the Lava language via cd(Lava). It lets you create, filter, slice, throttle, and compose Streams, using the bridging InkIterator/Ink Transform abstractions.
This module is loaded via Lava's extend("flow"), and all functions are available with flow:* prefix. They have partial and placeholder support.
Key Features
- Functions:
compose,trans,filter,sllce,to_array,throttleand more - Support for
InkIterator,InkTransformchaining, all partial application and placeholders - Full doc: https://lava.nu11.uk/#flow
installation
Requires Lava / mumu installed.
Composition
extend("flow")
extend("math")
flow:compose(
slog,
flow:trans(math:multiply(2)),
flow:trans(math:plus(100))
)(ink(1,20))
extend("flow")
// This will not process 50000000 items
// because it is flow:compose pulls
// only what it needs.
actual = flow:compose(
flow:to_array,
flow:slice(1,4),
flow:trans(n => n * 10)
)(ink(1,50000000))
slog(actual)
Other important functions
flow:to_array- Consumes all items from an InkIterator or InkTransform to a array.flow:throttle- Throttles iteration by a given number of milliseconds.flow:compose- Combines multiple functions to make a chain.
Licensing
This project is dual-licensed under MIT or Apache-2.0. See LICENSE.
Contributing
Pull requests and issues are welcome at https://gitlab.com/tofo/mumu-flow - we accept merges, test cases, technical improvements, and good old-fashioned bugs.