Flurry

From Esolang
Jump to navigation Jump to search

Flurry is a strict functional programming language created by User:Challenger5 and inspired by Brain-Flak. The main difference in execution model is that there is only one stack, which contains functions. Functions are allowed to modify the stack, but are otherwise pure.

All nilads and monads return functions. Rather than denoting integer addition, juxtaposition denotes function application.

The nilads are as follows:

  • (): return the K combinator.
  • []: return the height of the stack as a Church numeral.
  • {}: pop the stack or return the I combinator if the stack is empty.
  • <>: return the T combinator (SK).

The monads are as follows:

  • (f): evaluate f, push the result to the stack and return it.
  • [f]: evaluate f and return it (used as a grouping operator since function application is not associative).
  • {f}: return a function that pushes its argument to the stack and then evaluates f.
  • <f>: evaluate f and return it, but interpret juxtaposition as forwards function composition rather than function application.

Input is encoded as Church numerals, and so is output.

Snippets

I combinator:

<><>

Swap the top two stack elements:

{{<><>}}{}{}

This takes advantage of evaluation order - both pops are evaluated before any application is performed.

Computational Class

Flurry is probably Turing-complete, but this has yet to be rigorously proven.