Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pakoito/RxCurrying

Simple currying for FuncN and ActionN on RxJava [STABLE]
https://github.com/pakoito/RxCurrying

Last synced: 24 days ago
JSON representation

Simple currying for FuncN and ActionN on RxJava [STABLE]

Awesome Lists containing this project

README

        

# RxCurrying

RxCurrying is a library to allow [currying](https://en.wikipedia.org/wiki/Currying) on RxJava function primitives.

For the RxJava 2.X version, please go to [RxCurrying2](https://github.com/pakoito/RxCurrying2).

## Usage

RxCurrying contains two classes, `RxCurryingAction` and `RxCurryingFunc`. Each contains a set of `curry()` methods to do split any function into its curried version. Curried methods allows calling them one parameter at a time, and execute them at the end. For example, a `Func3` becomes a `Func1>>`, or an `Action4` becomes `Func1>>`.

Function to print the sum of two numbers:
```java
Func1> adder = RxCurryingAction.curry((int first, int second) -> { System.out.print(first + second); });
Action1 intermediate = adder.call(3);
intermediate.call(2); // prints 5
```

Append 5 strings:
```java
Func1>>>> appender = RxCurryingFunc.curry((String first, String second, String third, String fourth, String fifth) -> { return first + second + third + fourth + fifth; );
Func1 intermediate = appender.call("Hello ").call("This ").call("Is ").call("Curried ");
String value = last.call("Func"); // value == "Hello This is Curried Func"
```

## Distribution

Add as a dependency to your `build.gradle`
```groovy
repositories {
...
maven { url "https://jitpack.io" }
...
}

dependencies {
...
compile 'com.github.pakoito:RxCurrying:1.1.0'
...
}
```
or to your `pom.xml`
```xml


jitpack.io
https://jitpack.io

com.github.pakoito
RxCurrying
1.1.0

```
## License

Copyright (c) pakoito 2016

The Apache Software License, Version 2.0

See LICENSE.md