Operators

Type Abbreviations

Type

Abbreviation

Number

N

String

S

Char

C

Block

B

Dict

D

Symbol

J

Operator Table

Name

Args

Ops

Overload

!

N|C

N : 1-N (logical not, complementary probability), C : swap case

__new__

#

LA..#A

LA..#A : map

$

A

A : deepcopy (duplicate)

%

LB|LS|LC|BN

LB : fold, LS : join, LC : join, BN : repeat

&

NN|SS

NN : bitwise and, SS : list all expressions matching the regex

__and__ / __rand__

*

NN

NN : multiply

__mul__ / __rmul__

+

NN|CC|SA|AS

NN : add, CC : add, SA : append string, AS : append string

__add__ / __radd__

-

NN|CC

NN : subtract, CC : subtract

__sub__ / __rsub__

/

NN

NN : divide

__div__ / __rdiv__

;

A

A : pop and discard

<

NN|SS|CC

NN : less than, SS : less than, CC : less than

__lt__ / __rlt__

=

AA

AA : equality

__eq__

>

NN|SS|CC

NN : greater than, SS : greater than, CC : greater than

__gt__ / __rgt__

?

AA

AA : if A1, then A2. If A2 is block, execute it

@

AAA

AAA : rotates the top three elements on the stack [abc->bca]

A

A

A : wrap in list

B

J|L|N|C

J : increment in place, L : uncons from front, N : increment, C : increment

__inc__

C

L|S|N

L : sort least to greatest, S : sort least to greatest, N : bitwise not

__sort__

D

ALN

ALN : set index

__setindex__

E

L|N|S

L : length, N : 10^N, S : length

__len__

G

S|N

S : read a string from a filename or URL, N : isprime

H

LA|DS|DC|DJ|SA

LA : has; 1 if list contains object, DS : has; 1 if dict contains key, DC : has; 1 if dict contains key, DJ : has; 1 if dict contains key, SA : has; 1 if string contains substring

I

LB|LL|LN

LB : filter, LL : get index, LN : get index

__getindex__

J

LA|AA|LL|AL

LA : add to list, AA : create list [ A A ], LL : join lists, AL : add to list

L

LL|AN|NL

LL : reshape, AN : create list by repeating A N times, NL : reshape

N

LA|DS|DJ|SS

LA : return index of first occurance, -1 if not found; keep list on stack, DS : contains key; keep dict on stack, DJ : contains key; keep dict on stack, SS : return index of first occurance, -1 if not found; keep list on stack

O

LB|DB

LB : Map block to list, DB : Map block to dict

__each__

P

A

A : to string

__str__

Q

L|N

L : random choice, N : N>0: random number 0-N, N<0: random number N-0, N=0: any int

__random__

R

L|N|C

L : len L = 2: range [N1, N1+1, …, N2], len l = 3: range [N1, N2, …, N3], N : range [1, 2 .. N], C : range [1, 2 .. N]

__range__

S

SC|LN|SS

SC : split at char, LN : split list at index, SS : split at regex

T

N

N : negate

__negate__

U

L

L : reverse

__reverse__

V

J|L|N|C

J : decrement in place, L : uncons from back, N : decrement, C : decrement

__dec__

W

B|L|D

B : while loop (repeat as long as block returns true), L : sum (fold using +), D : export all variables

X

A

A : assign to variable x and pop from stack

Y

A

A : assign to variable y and leave on stack

Z

N|S

N : cast to bignum, S : parse to bignum

\\

AA

AA : swap top two elements on the stack

^

NN|SS

NN : power, SS : levenshtein distance

__pow__ / __rpow__

|

NN

NN : logical or

__or__ / __ror__

~

B|L|S|C|D

B : evaluate, L : dump to stack, S : evaluate, C : evaluate, D : set variables if they exist in the local scope

.!

B|N|S

B : copy block without header, N : signum, S : parse if number

__signum__

.$

..AN

..AN : copies the Nth item on the stack to the top (not including N)

.%

NN

NN : integer division

__idiv__ / __ridiv__

.&

SSS|LLB|SNN|LNN|NNN

SSS : replace all occurances of the regex S1 with S2 in S3, LLB : zip with, SNN : convert base of N|S|L from N1 to N2, LNN : convert base of N|S|L from N1 to N2, NNN : convert base of N|S|L from N1 to N2

.'

L|N|S

L : convert number list to string using UTF-8 encoding, N : cast to char, S : cast to char

.(

NN

NN : left bitwise shift

.)

NN

NN : signed right bitwise shift

.*

B|L

B : decompile, L : compile

.+

NN|BD|BJ|BL<J>|DD

NN : gdc, BD : swap vars in a copy of B for values defined in D, BJ : constant capture variable from outer scope, BL<J> : constant capture variables from outer scope, DD : update D1 with the values from D2 (modify D1)

.-

DS|DJ|LL|NN|LN

DS : remove key from dict, DJ : remove key from dict, LL : remove items at indices L1 from L2, NN : lcm, LN : remove item at index N from L

./

N

N : ceiling

__ceil__

.;

..A

..A : clear the entire stack

.<

SN|LN|NN|SS|CC

SN : head / pad ‘ ‘, LN : head / pad 0, NN : greater of, SS : greater of, CC : greater of

__head__

.=

LA|LL|AL

LA : element-wise equivalence, LL : element-wise equivalence, AL : element-wise equivalence

.>

SN|LN|NN|SS|CC

SN : tail / pad ‘ ‘, LN : tail / pad 0, NN : lesser of, SS : lesser of, CC : lesser of

__tail__

.?

AAA

AAA : if A1 then A2, else A3. If A2/A3 are blocks, execute

.@

..AN

..AN : moves the Nth item on the stack (not including N) to the top

.A

..A

..A : wrap entire stack in a list

.B

AL

AL : append item to the back of a list

.C

LB|NN

LB : sort least to greatest by applying B to L, NN : xor

.D

A

A : throw an exception containing A

.E

L

L : length, keep list on stack

__len__

.F

L

L : flatten nested list

.G

ASN

ASN : write A as a string to file located at S. N = 0, overwrite. N = 1, append

.I

LNA|DSA|DJA

LNA : getindex with default value, DSA : getindex with default value, DJA : getindex with default value

__getindex__

.K

BB

BB : try B1, if error, execute B2. Neither block has access to the global stack

.M

A

A : get metatable

.N

LB

LB : return the index of the first element of L that satifies E; keep list on stack

.O

AB

AB : apply

.P

A

A : print to stdout

.Q

-

- : return a random decimal from 0 to 1

.R

L|N

L : linspace [from to count], if count not provided, use 100, N : range [0, 1, .., N-1]

.S

LL|LN

LL : rotate [rows cols], LN : rotate]

.T

L

L : transpose a 2d list

.U

S

S : requests a string using a ui dialog, S is the prompt text

.V

AL

AL : append item to back of list

.\\

N

N : floor

__floor__

.^

N|S

N : square root, S : quote regex

__sqrt__

.|

B|N

B : get meta information for a block, N : absolute value

__abs__

.~

B|J|S|C|D

B : get contents of block, J : deref variable; if not a block, put contents in block, S : parse contents to a block, C : parse contents to a block, D : set all variables

:!

AA

AA : assert equal

:#

L:#B|D:#B

L:#B : map, D:#B : map over key value pairs

__each__

:$

..AN

..AN : copies the first N items on the stack (not including N)

:%

NN

NN : mod

__mod__ / __rmod__

:&

A

A : duplicate reference (same as $ but does not make a copy)

:'

S|N|C

S : convert a string to bytes using UTF-8 encoding, N : identity; return N, C : to int

:*

LLB

LLB : outer product of two lists using B

:;

..AA

..AA : clear all but the top of the stack

:<

NN|SS|CC

NN : less then or equal to, SS : less then or equal to, CC : less then or equal to

__leq__ / __rleq__

:=

AJ|AC|AS

AJ : assign A to variable, AC : assign A to variable, AS : assign A to variable

:>

NN|SS|CC

NN : greater than or equal to, SS : greater than or equal to, CC : greater than or equal to

__geq__ / __rgeq__

:?

A

A : convert to boolean

:@

AA

AA : isinstance

:A

..AN

..AN : collect N items from stack into list

:B

S

S : interpolate string

:C

J|S

J : convert symbol to string name, S : return S

:D

ASD|AJD

ASD : set dict index, AJD : set dict index

:E

L|D

L : shape, D : number or items in a dict

:G

n/a : Return the variable scope stack as a list of dicts

:I

DS|DJ

DS : get dict item from key, DJ : get dict item from key

:J

LA|AA|LL|AL

LA : add to list (modify list), AA : create list [ A A ], LL : concatenate lists (modify list 1), AL : add to list (modify list)

:K

D

D : return a list of keys as symbols

:M

BD|DD

BD : duplicate block with the given metadata, DD : set D1’s meta to D2 leave D1 on stack

:N

LA

LA : find all instances of A in L

:O

AAB

AAB : apply (2-arg)

:P

A

A : println to stdout

:R

-

- : readline from stdin

:S

B|S|C

B : if block has single var or op convert to symbol list, else return empty list, S : convert to symbol, C : convert to symbol

:T

A

A : type of (returns a symbol)

:V

D

D : return a list of values

:Z

N

N : sleep (milliseconds)

:`

BN:`A

BN:`A : wrap next N instructions in a block

:|

LL

LL : remove all elements in L2 from L1

:~

L

L : remove duplicates

M!

N

N : factorial

__fact__

M#

A

A : hash code of the object

M$

-

- : system time in milliseconds

M?

B|N|S

B : get help data for operator, N : list op descriptions where N=[0:std, 1:dot, 2:colon, 3:misc], S : search all help data

MC

N

N : inverse cosine

__acos__

MI

NN

NN : create complex number

ML

N

N : base-10 logarithm

__log__

MS

N

N : inverse sine

__asin__

MT

N

N : inverse tangent

__atan__

Ma

J

J : Aya meta information

Mb

B|J

B : duplicate block, add locals if they do not exist, J : is defined

Mc

N

N : cosine

__cos__

Md

N|S

N : cast to double, S : parse double, if invalid, return 0.0

__float__

Me

N

N : exponential function

__exp__

Mi

N

N : imag part of complex number

__imag__

Mk

CS|NN

CS : add special character, NN : unsigned right bitshift

Ml

N

N : natural logarithm

__ln__

Mm

D

D : true if the dict has a metatable, leave D on stack

Mp

N

N : list primes up to N

Mr

N

N : convert to fractional number

Ms

N

N : sine

__sin__

Mt

N

N : tangent

__tan__

Mu

NN

NN : y x Mu => atan2(y,x)