Codack

From Esolang
Jump to navigation Jump to search

Codack (CODing stACK) uses Codacks to do stuff

Codack stuff

Codack format

Codacks are formatted like this /\[((<c>|(\d+))(,(<c>|(\d+)))*)?\]/
examples that are formatted correctly:

[1,2,3,5]
[code,3,code,9]
[code,code,code,code]
[]
[1]
[1,2]
[1,2,3]
[1,2,3,4]
[1,2,3,4,5]

note: 'code' is a placeholder for code that could go there
Codacks can contain Codacks

[[1,2,3,4,5],12,2,[1,3,45,5,4,32,3,4,2,8],4,0,[1,2,3,5,6,3,0,3,4],0,3,[1,3,4,5,3,2,43,4,32]]

Codack Interactions

Run the nth item of a Codack "R<n>", if it is not a code on that, it returns that

R<0>[1,2,3,4] - returns 1

Flip the Codack "F"

F[1,2,3,4] - [4,3,2,1]

Combine two Codacks A and B "J<A>B"

J<[1,2,3,4]>[5,6,7,8] - [1,2,3,4,5,6,7,8]

Nothing except first "A"

A[1,2,3,4] - [1]

All but first "B"

B[1,2,3,4] - [2,3,4]

Function with input A and output O "X<A><O>"

X<a><BBa>[1,2,3,4] - [3,4]

Flatten a Codack so that for example [1,2,[3,4],5,6] becomes [1,2,3,4,5,6] "T"

T[1,[2,3],4] - [1,2,3,4]

Take out the values of a codack "O"

O[1] - 1

Codack Examples

Not gate

X<a><Oa[B,A]>A - B
X<a><Oa[B,A]>B - A

Or gate

X<x><X<y><Ox[A,y]>>
or A B - A
or B B - B
or B A - A
or A A - A