Constantinople

From Esolang
Jump to: navigation, search

Constantinople is a language created by Nathan van Doorn. It is named as such because he had Istanbul, not Constantinople stuck in his head.

In Constantinople, memory is stored in a list, the first element of which is another list, filled with 0s. The rest of the list is filled with 0s.

There are two datatypes, the list, and the bit, which can either be 0 or 1. Lists are infinite and lazily evaluated.

Syntax

replace m with n  replaces whatever's at m with n
repeat n          starts a repeat block, which repeats the commands to the corresponding end command while n evaluates to 0
end               ends a repeat block
in n              replaces n with a bit from input
out n             outputs the bit n.
head n            returns the first element of n
tail n            returns everything but the first element of n
nand m with n     returns m NAND n. m and n

Brackets (i.e. "(" and ")") are used to change evaluation order, and clarify what's an input to what.

The head and tail of a bit are the value of the bit. When a list is used in nand, repeat, or out, the first element of the list is used instead.

head, tail, and nand may only be used in an argument context. replace, repeat, in and out must not. (The ... in repeat is not an argument context.)

If an argument is missing, it is assumed to be the main list.

Examples

CAT

repeat tail
in head
out
end

External resources