pub fn cons() -> Term
Expand description

Applied to two terms it returns them contained in a Parigot-encoded list.

CONS ≡ λaxnc.c a x ((λl.l) x n c) ≡ λ λ λ λ 1 4 3 ((λ 1) 3 2 1)

Example

use lambda_calculus::data::list::parigot::{nil, cons};
use lambda_calculus::*;

let list_consed =
    app!(
        cons(),
        1.into_parigot(),
        app!(
            cons(),
            2.into_parigot(),
            app!(
                cons(),
                3.into_parigot(),
                nil()
            )
        )
    );

let list_into = vec![1, 2, 3].into_parigot();

assert_eq!(
    beta(list_consed, NOR, 0),
    list_into
);