Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ispringle/masala
https://github.com/ispringle/masala
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ispringle/masala
- Owner: ispringle
- Created: 2021-07-24T14:34:18.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-16T22:22:51.000Z (over 1 year ago)
- Last Synced: 2024-11-30T11:15:54.417Z (24 days ago)
- Language: Rust
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Masala
An autocurrying macro for Rust.
## Usage
This crate requires nightly:
```rust
use masala::curry;#[curry]
fn mul(a: T, b: T) -> T {
a * b
}#[curry]
fn add(a: Fn(T), b: T, t:T) -> T {
a + b
}#[curry]
pub fn psi(a: fn(T, T) -> T, b: fn(T) -> T, c: T, d: T) -> T {
a(b(c.clone()), b(d))
}fn main() {
let add_10 = add(10);
println!("{}", psi(mul)(add)(10)(3)); // (10 + 10) * (3 + 10) = 33
}
```## TODO
- [x] Allow for Generics
- [ ] ~Allow for curry functions to be written similar to~