rosetta/y_combinator.bruijn

Problem description

:import std/Number .

# sage bird combinator
y [[1 (0 0)] [1 (0 0)]]

# factorial using y
factorial y [[=?0 (+1) (0 ⋅ (1 --0))]]

:test ((factorial (+6)) =? (+720)) ([[1]])

# (very slow) fibonacci using y
fibonacci y [[0 <? (+1) (+0) (0 <? (+2) (+1) rec)]]
	rec (1 --0) + (1 --(--0))

:test ((fibonacci (+6)) =? (+8)) ([[1]])