CContains

From Esolang
Jump to navigation Jump to search
The title of this article is not correct because of technical limitations. The correct title is actually "cContains:".

cContains: is an esolang by User:Ϫ based on Javascript arrays and set theory. The main principle of cContains: is sets, which are written like this:

[1, 3, OTHERSET]

Ccommands act upon given elements of a set, or all elements if not specified. Sets can be nested and commands can use a path to navigate them.

Commands and Syntax

Syntax

Any string can be an identifier, as long as it doesn't use symbols, numbers, spaces or lowercase letters. To define a set, you use this syntax:

SETNAME:[THING, OTHERTHING]

A command is written like this:

COMMANDIDENTIFIER -> SET

A command can have a path, describing a specific thing. For example:

BRICK:[2,3,4]
EGG:[2,4,5]
FISH:[BRICK, BRICK, EGG, EGG]
SET:[FISH]
OUTPUT -> SET{1,4,2

...would output 4.
Additionally, there are special sets that have certain properties:

$IN: The user can tamper with the contents of this set, therefore making it the input.
$CLIP/IDENTIFIER: Used for COPY/IDENTIFIER. The identifier name follows the same rules as set names.
$RESULT/CONTAINERFILE: The result of the given container code. I'll explain further.
$INT: Cannot be changed; any changes will result in an error. Contains the numbers 1 to 1000 in order.

Commands

OUTPUT: Sends the specified element to the console. Does not work with whole sets.
FLIP: Reverses the order of a set. Does not work with singular items.
HIGHEST: Removes all items in the set except for the highest value. Ignores nested sets.
LOWEST: Like HIGHEST, but the lowest.
COMMON: Like HIGHEST, but the mode.
COPY/IDENTIFIER: Stores the contents of the set in the $CLIP/ with the same identifier. Does not work with singular items.
PROJECT/IDENTIFIER: Overrides the set's current contents with the corresponding $CLIP/. Does not work with singular items.
MARK/IDENTIFIER: Takes no set inputs, stands alone. Used for JUMP/.
JUMP/IDENTIFIER: Takes no set inputs, stands alone. Return to the corresponding MARK/.
SET?: Only runs the next command if the item in the given path is a set. Requires a path.
INT?: Like SET?, but for integers.
DOUBLE: Doubles the specified item, or all items in the given set.
INC: Increments the specified item, or all items in the given set.

Container Code

A container is like an extension, another cContains: script that is run before the program starts. All cContains: containers have to use a name with the same restrictions as set names and identifier names. Anything that is sent to the console with OUTPUT will instead go to this script's corresponding $RESULT/IDENTIFIER. Please append CCONTAINS to the names of any cContains: containers you share on Esolangs.