<!DOCTYPE html>
<html>
<body>
<h1>Please open console</h1>
</body>
</html>
JavaScript
const _ = a => a.length === 0 ? a() : a; // lazy eval helper
const TRUE = a => b => () => _(a);
const FALSE = a => b => () => _(b);
const NOT = a => () => _(_(_(a)(b => c => () => _(c)))(b => c => () => _(b)));
const AND = a => b => () => _(_(_(a)(_(b)))(_(a)));
const OR = a => b => () => _(_(_(b)(_(b)))(_(a)));
const ZERO = a => b => () => _(b);
const IS_ZERO = a => () => _(_(_(a)(b => c => d => () => _(d)))(b => c => () => _(b)));
const SUCC = a => b => c => () => _(_(b)(_(_(_(a)(_(b)))(_(c)))));
const PRED = a => b => c => () => _(_(_(_(a)(d => e => () => _(_(e)(_(_(d)(_(b)))))))(d => () => _(c)))(d => () => _(d)));
const PLUS = a => b => c => d => () => _(_(_(a)(_(c)))(_(_(_(b)(_(c)))(_(d)))));
const MULT = a => b => c => () => _(_(a)(_(_(b)(_(c)))));
const COMPOSE = a => b => c => () => _(_(a)(_(_(b)(_(c)))));
const IF = a => b => c => () => _(_(_(a)(_(b)))(_(c)));
const NIL = a => b => () => _(b);
const IS_NIL = a => () => _(_(_(a)(b => c => d => e => () => _(e)))(b => c => () => _(b)));
const CONS = a => b => c => d => () => _(_(_(c)(_(a)))(_(_(_(b)(_(c)))(_(d)))));
const HEAD = a => () => _(_(_(a)(b => c => () => _(b)))(b => c => () => _(c)));
const TAIL = a => b => c => () => _(_(_(_(a)(d => e => f => () => _(_(_(f)(_(d)))(_(_(e)(_(b)))))))(d => () => _(c)))(d => e => () => _(e)));
/* const Y = a => _((b => () => _(_(a)(_(_(b)(_(b))))))(b => () => _(_(a)(_(_(b)(_(b))))))); */
const Z = a => _((b => () => _(_(a)(c => () => _(_(_(b)(_(b)))(_(c))))))(b => () => _(_(a)(c => () => _(_(_(b)(_(b)))(_(c)))))));
const value = a => ({
as: b => {
switch (b) {
case 'boolean':
return _(_(_(a)(true))(false));
case 'number':
return _(_(_(a)(b => _(b) + 1))(0));
default: {
if (b.startsWith('list')) {
const types = b.substring(5, b.length - 1).split(',');
const toArray = c => d => _(IS_NIL(_(d)))(true)(false)() ?
[] :
[value(_(HEAD(_(d)))).as(types[c]), ...toArray(types.length...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.