Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/rizo/ppx_lambda

Simplified lambda syntax extension for OCaml.
https://github.com/rizo/ppx_lambda

Last synced: about 1 month ago
JSON representation

Simplified lambda syntax extension for OCaml.

Awesome Lists containing this project

README

        

ppx_lambda
==========

Simplified lambda syntax extension for OCaml.

```ocaml
let obtain_number = () => 42
let inc = x => x + 1
let ignore = (x) => 42
let hello = name => "Hello, " ^ name ^ "!"
let sum = x y => x + y

let test () =
assert (inc 1 = 2);
assert (inc 101 = 102);
assert (inc (-1) = 0);
assert (ignore 987 = 42);
assert (ignore true = 42);
assert (ignore () = 42);
assert (hello "Bob" = "Hello, Bob!");
assert (((x => x + 1) 1) = 2);
assert (sum 2 3 = 5);
assert ((List.map (x => x * x) [1; 2; 3]) = [1; 4; 9]);
```