version: 0.1.0
This package contains a set of function utilities I have found useful in my own projects. I plan to keep adding to this as I find new ones.
resolvers += Resolver.sonatypeRepo("public")
...
libraryDependencies += "org.driangle" %% "flunc" % "0.1.0"
Use a LazyChain to lazily define operations on a collection of events/messages that will arrive at a future time.
import org.driangle.flunc.LazyChain
// define a chain that will filter out any number not divisible by 2 and then square it
val chain : Function[Int, Unit] = LazyChain.build[Int]()
.filter(x => x % 2 == 0)
.map(x => x * x)
.foreach(println _)
// simulating events/messages that will arrive at a future time
chain(1) // will be filtered out
chain(2) // will remain, then will be squared, then will be printed
chain(3) // will be filtered out
chain(4) // will remain, then will be squared, then will be printed
chain(5) // will be filtered out
This software is licensed under the Apache 2 license, quoted below.
Copyright 2019 Germán Greiner
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.