We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Quylthulg

From Esolang
Jump to navigation Jump to search

Quylthulg is an esoteric programming language designed by Chris Pressey in 2008. It is a non-recursive pure functional language with a single control mechanism called foreach. In fact, it does also have a goto statement, but it may only occur inside data structures. It also features a macro processor (which is also non-recursive and which is intertwined somewhat with the rest of the language.)

Syntax

The majority of Quylthulg binary operations are expressed in "panfix" notation: the symbol indicating the operation precedes, follows, and is placed in-between the operands, as in:

+1+2+

Variable names consist of (nearly) arbitrary text surrounded by $ symbols.

The syntax of the foreach construct is:

foreach loop-var=list with accumulator=initial-value be expression else be expression

The foreach construct can double as an "if" and a "let".

Example program

foreach $n$=:L:[1,2,3|goto$L$] with $a$=1 be +$a$+$n$+ else be abort

Computational class

Although the foreach mechanism can only traverse a list, cyclic lists can be created using gotos. Quylthulg should therefore be Turing-complete; for instance, it should be possible to express the state-transition diagram of a Turing machine as a cyclic list which is foreach'ed over, and the tape of the Turing machine as a pair of lists passed into the accumulator of the foreach. However, this has never been formally proved.

External resources