Quick Reference
x
is any scalar (int or char). a
or b
is any type (including lists)
mathy ops | ||
+ add |
int x → x |
1 2+ → 3 |
char int → char |
'a 1+ → 'b |
|
- sub |
x int → x |
5 3- → 2 |
char char → int |
'b 'a- → 1 |
|
* mult |
int int → int |
2 3* → 6 |
/ div |
int int → int |
7 2/ → 3 |
% mod |
x int → int |
7 2% → 1 |
^ pow |
int int → int |
2 3^ → 8 |
_ negate |
int → int |
1_ → -1 |
| abs |
int → int |
5~| → 5 |
( pred |
x → x |
4( → 3 |
) succ |
x → x |
'a) → 'b |
} countTo |
int → [int] |
3} → [1,2,3] |
{ wholes |
[int] |
{ → [0,1,2,... |
# sum |
[x] → int |
1,2,3,4 # → 10 |
char ops | ||
+ match |
[char] [char] → [[char]] |
"a12b3" "\d+"+ → ["12","3"] |
^ charRange |
char char → [char] |
'a'f^ → "abcdef" |
_ read |
[char] → int |
"23"_ → 23 |
} readAll |
[char] → [int] |
"1,2 3"} → [1,2,3] |
| ord |
char → int |
'd| → 100 |
|, chr |
int → char |
100|, → 'd |
` str |
int → [char] |
5` → "5" |
` strip |
[char] → [char] |
" a b\n"` → "a b" |
* replicate |
[char] int → [char] |
"ab"3* → "ababab" |
* join |
[[char]] [[char]] → [char] |
1,2,3 " "* → "1 2 3" |
/ split |
[char] [char] → [[char]] |
"a b c " " "/ → ["a","b","c"] |
% cut splitKeepEmpties |
[char] [[char]] → [[char]] |
"a b c " " "% → ["a","","b","c",""] |
generic ops | ||
a append |
[a] [a] → [a] |
"ab" "cd"a → "abcd" |
b backwards reverse |
[a] → [a] |
"abc"b → "cba" |
c cons |
[a] a → [a] |
1,2 0c → [0,1,2] |
d drop |
[a] int → [a] |
"abcde" 2d → "cde" |
g get |
[a] int → a |
"abcd" 2g → 'c |
h head |
[a] → a |
"abc"h → 'a |
j just |
a → [a] |
1j → [1] |
k keep take |
[a] int → [a] |
"abcde" 2k → "ab" |
l last |
[a] → a |
"abc"l → 'c |
n not |
a → int |
0,1,2n → [1,0,0] |
o or |
a a → a |
" bc" '- o → "-bc" |
p pivot transpose |
[[a]] → [[a]] |
"abc","def"p → ["ad","be","cf"] |
q quantity len |
[a] → int |
"abc"q → 3 |
r repeat |
a → [a] |
1r → [1,1,1,1,1,1... |
s sortBy |
[a] [b] → [a] |
"abc","d":len S → ["d","abc"] |
t tail |
[a] → [a] |
"abc"t → "bc" |
u unite concat |
[[a]] → [a] |
"ab","cd","e"u → "abcde" |
v vet filter |
[a] [b] → [a] |
"abcdef":2%v → "ace" |
w while takeWhile |
[a] [b] → [a] |
"abc def":w → "abc" |
x exclude setDiff |
[a] [a] → [a] |
"abra" "ra"x → "ba" |
y yesNo ifElse |
a b b → b |
0 1 2 y → 2 |
z zeroPad |
[a] → [a] |
1,2,3 z → [1,2,3,0,0,... |
= equal |
a a → int |
1,2,3 1= → [1,0,0] |
< lessThan |
a a → int |
1,2,3 2< → [1,0,0] |
. index |
[a] a → int |
"abcd" 'c . → 3 |
& reshape |
[a] [int] → [[a]] |
"abcdef" 2& → ["ab","cd","ef"] |
? debut isFirst |
[a] → [int] |
"aardvark"? → [1,0,1,1,1,0,0,1] |
\ chunkWhen |
[a] [b] → [[a]] |
"ab cd e":\ → ["ab ","cd ","e"] |
folding ops | ||
i iterate |
a ([a] → [a]) → [a] |
0 i 1,2,3+ → [0,1,3,6] |
e expand iterate0 |
([a] → [a]) → [a] |
e 1,2,3+ → [0,1,3,6] |
f foldr |
a ([a] → [a]) → a |
0 f 1,2,3+ → 6 |
m meld foldr0 |
([a] → [a]) → a |
m 1,2,3+ → 6 |
stack ops | ||
: dup |
a → a a |
5: → 5 5 |
; mdup |
a (a → b) → b a |
5;1- → 4 5 |
special symbols | ||
$ | arg | 5;$+ → 10 5 |
! | pop from outer stack | 2 5;!+ → 7 5 |
> | end block | 3;))> → 5 3 |
, | unvec | "ab"j, → ["ab"] |
@ | register get/set | @( 5@) → 4 6 |
[ ] | push pop | 5[( ]) → 4 6 |
~ | assignment | 5~a( a) → 4 6 |
low rank overloads | ||
U uppercase |
char → char |
'a U → 'A |
L lowercase |
char → char |
'A L → 'a |
P parts splitWS |
[char] → [[char]] |
"ab c\n d" P → ["ab","c","d"] |
p digits |
int → [int] |
123 p → [1,2,3] |
U undigits |
[int] → int |
1,2,3 U → 123 |
K kCopy |
int int → [int] |
4 3K → [4,4,4] |
D digitize toBase |
int int → [int] |
6 2 D → [1,1,0] |
W baseWas baseFrom |
int [int] → int |
2 1,1,0 W → 6 |
B rangeFrom rangeBegin |
x → [x] |
2B → [2,3,4,... |
T rangeTo |
int → [int] |
3T → [0,1,2] |
u unsquare sqrt |
int → int |
9u → 3 |
A min |
x x → x |
4 5 A → 4 |
X max |
x x → x |
"bc" "ad" X → "bd" |
H hyper pow10 |
int → int |
2H → 100 |
P prod |
[int] → int |
1,2,3,4 P → 24 |
debugging ops | ||
nil |
[a] |
nil → [] |
pad |
[a] a → [a] |
1,2 3 pad → [1,2,3,3,3... |
show |
a → [char] |
1,2 show → "[1,2]" |
type |
a → [char] |
1,2 type → "[int]" |
version |
[char] |
version → "0.1-alpha+, ruby3.1.2" |
pp |
a → |
1,2 → prints [1,2] |
nuke |
a → |
1 2 nuke → 1 |