πŸ†’

From Esolang
Jump to navigation Jump to search

πŸ†’ is an esoteric programming language currently developed by User:Fogity. It is a fairly straight forward lazy functional language with the caveat that the source code, input, and output must consist solely of emoji.

Language

The language consists of four elements: sequences, definitions, variables and literals.

Sequences are just series of elements and are enclosed in πŸ†“ and πŸ›‘.

Definitions are on the form

πŸ†•<param count><name><params><body>πŸ›‘

Any emoji not used for syntax may be used as variables and the param count may be omitted if it is zero.

More details on the language can be found on the repository wiki of the official interpreter.

Execution

A function grabs as many arguments as it needs from successive elements in the sequence and is then executed, this is then repeated for the remaining elements in the sequence.

The language is lazy by default, but the modifiers πŸ–‡ and πŸ“Ž may precede parameters to make all or specific arguments strict.

Example programs

Hello, world!

πŸ’¬πŸ”€πŸ‘‹πŸ—ΊοΈπŸ”€

Due to the emoji-restriction the output string is not the classic "Hello, world!" but an emoji equivalence.

A palindrome

πŸ’¬πŸ”£πŸ’¬

Cat

πŸ’¬βŒ¨οΈ

The input is of course restricted to emoji, and the input convention must be followed.

Fibonacci sequence

πŸ†•2οΈβƒ£πŸšπŸ–‡βͺβ—€οΈπŸ’¬β—€οΈπŸšβ—€οΈπŸ†“βž•βͺβ—€οΈπŸ›‘πŸ›‘πŸš1️⃣1️⃣

Factorial

πŸ†•1οΈβƒ£πŸ­πŸ“Ž#οΈβƒ£β“πŸ†“βš–οΈ#️⃣0οΈβƒ£πŸ›‘1οΈβƒ£πŸ†“βœ–οΈ#οΈβƒ£πŸ†“πŸ­πŸ†“βž–#️⃣1οΈβƒ£πŸ›‘πŸ›‘πŸ›‘πŸ›‘πŸ’¬πŸ†“πŸ­πŸŽ›οΈπŸ›‘

Ackermann function

πŸ†•2οΈβƒ£πŸ“ˆπŸ–‡πŸ”΄πŸ”΅β“πŸ†“βš–οΈπŸ”΄0οΈβƒ£πŸ›‘πŸ†“βž•πŸ”΅1οΈβƒ£πŸ›‘πŸ†“πŸ“ˆπŸ†“βž–πŸ”΄1οΈβƒ£πŸ›‘πŸ†“β“πŸ†“βš–οΈπŸ”΅0οΈβƒ£πŸ›‘1οΈβƒ£πŸ†“πŸ“ˆπŸ”΄πŸ†“βž–πŸ”΅1οΈβƒ£πŸ›‘πŸ›‘πŸ›‘πŸ›‘πŸ›‘πŸ’¬πŸ†“πŸ“ˆπŸŽ›οΈπŸŽ›οΈπŸ›‘

Truth-machine

πŸ†•πŸ”‚πŸ’¬1οΈβƒ£πŸ”‚πŸ›‘β“πŸ†“βš–οΈπŸŽ›οΈ0οΈβƒ£πŸ›‘πŸ†“πŸ’¬0οΈβƒ£πŸ›‘πŸ”‚

FizzBuzz

πŸ†•3οΈβƒ£πŸ―πŸ–‡πŸ‹πŸŒΌ#οΈβƒ£πŸ†•πŸ₯€βš–οΈπŸ‹1οΈβƒ£πŸ›‘πŸ†•πŸβš–οΈπŸŒΌ1οΈβƒ£πŸ›‘πŸ’¬πŸ†“β“πŸ₯€πŸ†“β“πŸπŸ”€πŸ₯€πŸπŸ”€πŸ”£πŸ₯€πŸ›‘πŸ†“β“πŸπŸ”£πŸ#οΈβƒ£πŸ›‘πŸ›‘πŸ―πŸ†“β“πŸ₯€3οΈβƒ£πŸ†“βž–πŸ‹1οΈβƒ£πŸ›‘πŸ›‘πŸ†“β“πŸ5οΈβƒ£πŸ†“βž–πŸŒΌ1οΈβƒ£πŸ›‘πŸ›‘πŸ†“βž•#️⃣1οΈβƒ£πŸ›‘πŸ›‘πŸ―3️⃣5️⃣1️⃣

Like with the hello world program the emoji πŸ₯€ and 🐝 replace the words "fizz" and "buzz", respectively.

Turing-completeness

The language is Turing-complete as it is easy to model the lambda calculus in it. Variables are equivalent to πŸ†’ variables. Application is equivalent to πŸ†’ application, but will generally need to be enclosed in a sequence. Abstractions are mostly equivalent to single parameter definitions, however they must be named and the definition must be followed by it's variable name, and they should also be enclosed in a sequence.

As an example here is the Y combinator (see Combinatory logic) written in πŸ†’ as a lambda term:

πŸ†•1οΈβƒ£βš½πŸ€πŸ†“πŸ†•1οΈβƒ£πŸˆβšΎπŸ€πŸ†“βšΎβšΎπŸ›‘πŸ›‘πŸˆπŸ›‘πŸ†“πŸ†•1οΈβƒ£πŸˆβšΎπŸ€πŸ†“βšΎβšΎπŸ›‘πŸ›‘πŸˆπŸ›‘πŸ›‘βš½

External resources