Skip to content

Instantly share code, notes, and snippets.

@vivekhaldar
vivekhaldar / church.js
Created March 4, 2016 21:11
Church numerals in ES6.
//#!/usr/bin/env node --harmony
/*jshint esversion: 6 */
'use strict';
// Church numerals in ES6.
// c.f. https://en.wikipedia.org/wiki/Church_encoding
// Zero is the identity function.
let zero = (f => x => x);
@vivekhaldar
vivekhaldar / church.py
Created April 21, 2012 17:11
Church numerals in Python
#! /usr/bin/python
#
# Church numerals in Python.
# See http://en.wikipedia.org/wiki/Church_encoding
#
# Vivek Haldar <vh@vivekhaldar.com>
#
# https://gist.github.com/2438498
zero = lambda f: lambda x: x
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello world!");
return 0;
}