An implementation of lazy Church-encoded lisp-style heterogenous lists using C++ lambdas
Features:
- No shared/global state
- No allocations
- Built only using lambdas: no structs or classes
- Heterogenous (can contain elements of different types)
- Compile-time: the types of elements as well as the length are known statically
- No dependencies, including the STL
- Supports common operations: map, reduce, flatten, flatmap, concat, zip, etc.
This library is an application of ideas from lambda calculus to C++. The list is implemented as a nested structure of Church pairs, which are lambdas that accept another lambda and call it with its 2 elements as arguments.
Recursion is also implemented in the style of lambda calculus: each recursive function accepts itself as an argument
Static dispatch between Nil and Cons is done via concepts and if constexpr