esolang

Catholicon

A golfing language in prefix notation. Every character is a function that reads its arguments after it.

Turing complete: unknown · ●●○ moderate

Tested with 10 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Catholicon is written in Elixir and calls itself a functional golfing language. A program is a single expression in Polish notation. +3 4 adds 3 and 4, and Ṗİ5 is the sum of the range from 1 to 5. There is no stack and there are no separators; a function takes as many expressions after it as it needs, and the evaluator reads them from the front of the code. Whatever is left over after the one expression is never run.

Read the story

When the code runs out while a function still wants an argument, the next line of input is read. So + on its own adds two lines of input.

The machine

Values are Elixir's integers of any size, floats, strings, lists, true and false. A run of digits is one integer, so +12 is not 1 plus 2 but 12 plus an input. A space is the identity function and separates numbers. Most functions go into lists on their own.

CodeDoes
12 "text"An integer, a string
+ * - /Arithmetic; - and / take their second argument first: /2 9 is 4.5
İ Ḣ Ṗ ṘRange from 1, range from 0, sum, product
Ȧ ḟ Ť ṡJoin two strings, upper case, reverse, length
Ċ HThe next line of input, the first line
ẋ ρ !Map, find, repeat until nothing changes, with the code up to ~
?cThe character c as a string

The result is printed with Elixir's IO.puts, as Try It Online's test does. A list of numbers therefore comes out as the characters with those codes.

Example

E is 10, so ṖİE sums 1 to 10.
Expected: 7
Expected: 4.5
Expected: 55
Expected: Hi, ann
Expected: 30

E is 10, so ṖİE sums 1 to 10. In the last program ẋ maps the code *D2 over 1 to 5, where D is the current item, and Ṗ adds up the doubles.

An input line is read as Elixir code when it is a literal, so 5 is a number and [1,2] a list. A capitalised word is an Elixir alias, so the input Ann becomes the atom Elixir.Ann, and the greeting says so.

Patterns it teaches

  • Code golf: prefix notation needs no brackets and no stack operations.

Try this

  1. Print the product of 1 to 6.
  2. Print the input in upper case.
  3. Hard: print the sum of the squares of 1 to 10.

Further

Also in Golfing

Write your own in Run Convert a program from Catholicon

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: catholicon.

Command line

shib run catholicon -e 'ṖİE'
shib manual catholicon

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/catholicon.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language