Skip to content

Instantly share code, notes, and snippets.

@CodaFi
CodaFi / Church.swift
Last active November 15, 2018 20:38
Church Encoding in Swift
/// Playground - noun: a place where people can play
/// Church-Turing clan ain’t nothing to func with.
/// Church encoding is a means of representing data and operators in the lambda
/// calculus. In Swift, this means restricting functions to their fully curried
/// forms; returning blocks wherever possible. Church Encoding of the natural
/// numbers is the most well-known form of encoding, but the lambda calculus is
/// expressive enough to represent booleans, conditionals, pairs, and lists as
/// well. This file is an exploration of all 4 representations mentioned.