-
Notifications
You must be signed in to change notification settings - Fork 0
Reference
Coercion : number to a set with just that number
[1, 2, 3] & [2, 3, 4]
# [2, 3]
[2, 3, 4] & [1, 2, 3]
# [2, 3]
[1, 2, 3] & [$->mod(2)==1]
# [1, 3]
[$->mod(2)==1] & [1, 2, 3]
# [1, 3]
Coercion : number to a set with just that number, real set to [$ in theSet]
[1, 2, 3] | [2, 3, 4]
# [1, 2, 3, 4]
[2, 3, 4] | [1, 2, 3]
# [1, 2, 3, 4]
[1, 2, 3] | [$->mod(2)==1]
# [($ in [1, 2, 3]) or ($->mod(2)==1)]
[$->mod(2)==1] | [1, 2, 3]
# [($ in [1, 2, 3]) or ($->mod(2)==1)]
Coercion : number to a set with just that number, real set to [$ in theSet]
[1, 2, 3] ^ [2, 3, 4]
# [1, 4]
[2, 3, 4] ^ [1, 2, 3]
# [1, 4]
[1, 2, 3] ^ [$->mod(2)==1]
# [($ in [1, 2, 3]) xor ($->mod(2)==1)]
[$->mod(2)==1] ^ [1, 2, 3]
# [($ in [1, 2, 3]) xor ($->mod(2)==1)]
Coercion : number to a set with just that number, real set to [$ in theSet]
[1, 2, 3] - [2, 3, 4]
# [1]
[2, 3, 4] - [1, 2, 3]
# [4]
[1, 2, 3] - [$->mod(2)==1]
# [($ in [1, 2, 3]) and !($->mod(2)==1)]
[$->mod(2)==1] - [1, 2, 3]
# [($->mod(2)==1) and !($ in [1, 2, 3])]
Some of these I genuinely have no idea what would happen if you were to use on description set since the way I made it work is by literally the data having a field to put its AST.
1 == 1
[1, 2] == [2, 1]
1 <> 2
[1, 2] <> []
ONLY WORKS ON TWO SINGLE NUMBERS
1 < 3
3 > 1
2 <= 2
3 >= 2
Right hand side must NOT be a single number
1 in [1, 2]
[1] in [[1], 2]
1 in [$<5]
Left hand side must NOT be a single number
[1, 2] has 1
[[1], 2] has [1]
[$<5] has 1
ONLY WORKS ON TWO BOOLEAN VALUES
true and true
true or false
false xor true
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
-1 == -1
-[1, 2, -3] == [-1, -2, 3]
ONLY WORKS ON BOOLEAN
!false
I do plan to add function definition but I haven't implemented that, so only built-ins for now.
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Absolute of every element
inputs : none
returns : set or number
-1 -> abs == 1
1 -> abs == 1
[-2, 3] -> abs == [2, 3]
DOESN'T WORK ON DESCRIPTION SET
If the source has just one item inside, return this item, if that item also just has one item inside, then that one. So on until the brackets can't be stripped off without turning into more than 1 element.
inputs : none returns : any
[] -> collapse == []
[1, 2] -> collapse == [1, 2]
[[[2]]] -> collapse == 2
[[$>0]] -> collapse == [$>0]
DOESN'T WORK ON DESCRIPTION SET
Coercion : number to a set with just that number
Returns a set of sets that are each an unique combination of the source set
inputs : how many elements
returns : set of sets
[1, 2, 3] -> comb(2) == [[1, 2], [2, 3], [1, 3]]
DOESN'T WORK ON DESCRIPTION SET
Coercion : number to a set with just that number
Count how many items are in this set
inputs : none
returns : number
[] -> count == 0
5 -> count = 1
[1, 2] -> count == 2
[1, [], [3, [4]]] -> count == 3
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Divide every element by a constant
inputs : divisor
returns : set or number
6 -> div(3) == 2
[1, 2, 4] -> div(2) == [0.5, 1, 2]
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Floor every element
inputs : none
returns : set or number
1.5 -> floor == 1
[1.5, 2] -> floor == [1, 2]
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER, OR EMPTY SET
The largest number in the set
inputs : none
returns : number
1 -> max == 1
[2, 3, 4] -> max == 4
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER, OR EMPTY SET
The smallest number in the set
inputs : none
returns : number
1 -> min == 1
[2, 3, 4] -> min == 2
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Every element to its n-modulo
inputs : n returns : set or number
3 -> mod(2) == 1
[6, 7, 8, 9] -> mod(3) == [0, 1, 2]
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Add a constant to every element
inputs : offsetAmount
returns : set or number
1 -> offset(2) == 3
[-1, 1, 2] -> offset(2) == [1, 3, 4]
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Every element to the power of a constant
inputs : exponent
returns : set or number
2 -> pow(2) == 4
[2, 3] -> pow(3) == [8, 81]
Print the data to standard output
inputs : none
returns : empty set
1 -> print
# 1.0
[1] -> print
# {1.0}
Coercion : number to [$==number], real set to [$ in theSet]
Collapse a description set within given range, both numbers are floored, the higher one is excluded
inputs : boundaryA, boundaryB
returns : real set
[$>5] -> realize(0, 11) == [6, 7, 8, 9, 10]
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Multiply every element by a constant
inputs : amplitude
returns : set or number
[1, 2] -> scale(2) == [2, 4]
DOESN'T WORK ON DESCRIPTION SET, OR A SET THAT HAS ANY NON-NUMBER
Sum up the set or just return the single number
inputs : none
returns : number
[1, 2, 3] -> sum == 6
6 == 6
ONLY WORKS ON SINGLE NUMBER
Write the Unicode character corresponding to the floored input in standard output
inputs : none
returns : empty set
65 -> text
# A
66.5 -> text
# B