Programming with Bananas in OCaml

By bananas, I mean banana brackets as in the famous paper “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire” by Meijer et al.  In this post I only focus on bananas, also called catamorphisms….

Lexical Scoping in OCaml

Like many other modern languages, OCaml uses lexical (or static) scoping.  That is, in OCaml, when your function includes a name that calls a variable, in the function, that variable has the value when the…

Currying in Lambda Calculus and OCaml

Currying Recall that in lambda calculus, a function can have more than one input, each preceded by a λ symbol.  Another way of thinking about more than one input is currying.  Currying a function of two…