rosetta/function_composition.bruijn
Problem description
:import std/Number .
# composition, bluebird combinator
…∘… [[[2 (1 0)]]]
:test (((inc ∘ (mul (+2))) (+3)) =? (+7)) ([[1]])
# 2x composition, blackbird combinator
…∘∘… [[[[3 (2 1 0)]]]]
:test (((inc ∘∘ mul) (+2) (+3)) =? (+7)) ([[1]])
# 3x composition, bunting combinator
…∘∘∘… [[[[[4 (3 2 1 0)]]]]]
:test (((inc ∘∘∘ (add ∘∘ mul)) (+1) (+2) (+4)) =? (+7)) ([[1]])
# reverse composition, queer bird combinator
…→… [[[1 (2 0)]]]
:test ((((mul (+2)) → inc) (+3)) =? (+7)) ([[1]])