Combine and continue

From Esolang
Jump to navigation Jump to search

Combine and continue or CAC is an esolang created by User:Yayimhere, created to make a church numeral based language, that is not actually Lambda calculus. CAC's idea was sparked by the original idea for Karvity

Memory

Memory is stored on an unbounded stack, starting with an infinite number of 1's on it.

Numbers

Every number is a function that when passed an input will repeat that input as many times as that numbers value.

Commands

The most basic command is push. it has the following syntax:

push x

where x can be any single CAC command with any amount of argument's. This will push x to the top of the stack

int where int is any base 10 nonnegative integer. When ran, it pops the top of stack, and runs it as code int times.

succ. This simply pops the top of the stack, increments any number within that element by 1, and pushes it again..

comb which pops two elements off of the stack, and combines them, with the bottommost element as the leftmost command. If there's any command that takes an argument, the top element is given as that argument.

split pops the top of the stack, splits it up into all the commands that make it up(also splitting arguments from the command using them) and pushes it all back, with the leftmost command at the bottom.

swap pops top two elements of the stack, and pushes them in reverse order.

\# x #\ separates commands. every command must be within, replacing the x

Turing completeness proof

Here is a proof that CAC is Turing complete, via translation from Underload, of which CAC basically just is a more church numeral oriented version.

Underload CAC Extra properties
(xy) \# push x #\ \# push y #\ \# comb #\ \# comb #\ the \# comb #\ must be repeated as many times as there's characters in the string being pushed
! \# 0 #\ some interpreters and compilers may not allow this
: \# push 2 #\ \# swap #\ \# comb #\ \# split #\ this assumes a church numeral is evaluated within a stack element
~ \# swap #\ *
* \# comb #\ this will not successfully work if there's just a single church numeral being concatenated

See also