Infunctional

From Esolang
Jump to: navigation, search

Infunctional is a small, minimalist dysfunctional programming language that relies on infix notation. In addition, all lambda abstractions accept two arguments instead of one.

Infunctional Operators

Infunctional only has two operators.

->
is the lambda abstraction, and
=
is assignment.

Behavior

Variable names are 1 character long:

a
b
c

The lambda abstraction is represented by the arrow: ->.

ab -> c

Variable "assignment" is done by the = operator. They are the equivalent to C's #define in that they perform simple textual replacements before the program is parsed.

some_variable = (xy -> x)

Function calls are done by placing the lambda expression in between its arguments. The following evaluates to a:

a(xy -> x)b

Function calls are left-associative:

a(xy -> x)b(xy -> x)c
is equivalent to
(a(xy -> x)b)(xy -> x)c

Both evaluate to a.

Examples

A Twisted Version of Church Numerals

zero = (sz -> z)
one = (sz -> zsz)
two = (sz -> zs(zsz))
plus = (xy -> (sz -> (syz)s(sxz)))

Binary Church Numerals?

Let z represent zero, o represent one, and p represent an arbitrary cons function.

zero = (pzo -> z)
one = (pzo -> o)
two = (pzo -> opz)
three = (pzo -> opo)
four = (pzo -> op(zpz))
five = (pzo -> op(zpo))