Multi-Set Manipulator/Smaller

From Esolang
Jump to navigation Jump to search

(Invented by User:A)All sets in Set Manipulator are multi-sets, although they can occasionally be treated as normal sets.

Set-manipulational instructions

A∩B A with all items not in B removed; Intersection
A∪B A with all B items appended; Union
AΔB (A-B)∪(B-A)
A\B A with all B items removed
() Grouping operator
"S" Someting that is not a set; it will be converted to a set automatically.
[1,2,"a","etc"] standard way of defining a multi-set, allowing numbers (as in Python). a is a name here if all of its characters are in lowercase.
i The set that results from 1 line of input; all results of each line are outputted by default.
@i length of i

Set-comparison instructions

∈ ELEMENT OF
∉ NOT AN ELEMENT OF
∋ CONTAINS AS MEMBER
∌ DOES NOT CONTAIN AS MEMBER
⊂ STRICT SUBSET OF
⊃ STRICT SUPERSET OF
⊄ NOT A SUBSET OF
⊅ NOT A SUPERSET OF
⊆ SUBSET OF OR EQUAL TO
⊇ SUPERSET OF OR EQUAL TO

Built-in Sets

I Positive integers
Z Integers {…-3,-2,-1,0,1,2,3,…}
P All prime numbers {2, 3, 5, 7, 11, 13, 17, …}
∅ null set

Integer comparision instructions

≠ NOT EQUAL TO; compares both values and multi-sets 
= equals sign; compares both values and multi-sets
< Less than
> Greater than
≤ LESS-THAN OR EQUAL TO
≥ GREATER-THAN OR EQUAL TO
a∣b Whether a Divides b
a∤b Whether a does not divide b

Logical instructions

⊻ XOR
⊼ NAND
⊽ NOR
∧ LOGICAL AND
∨ LOGICAL OR
¬ not sign
⊭ NOT TRUE
⊨ TRUE

Integer manipulational instructions

÷ Division
· Multiplication
+ Addition
- Subtraction

Proof as a programming language

Primality checker

i∈P

Unary Adder

i∪i

Exchange "Good" and "Bad"

"Goodbad"/i

See also