Op Notes
This page is auto generated and shows the help <op>
for any op that was deemed complicated enough to require a description.
div /
0/0 is 0
Num Num → Num
7/3 → 2
10/5 → 2
9/5 → 1
11/(5-) → -3
10/(5-) → -2
11-/5 → -3
10-/5 → -2
10-/(5-) → 2
9-/(5-) → 1
1/0 → DynamicError
0/0 → 0
mod %
anything mod 0 is 0
Num Num → Num
7%3 → 1
10%5 → 0
9%5 → 4
11%(5-) → -4
10%(5-) → 0
11-%5 → 4
10-%5 → 0
10-%(5-) → 0
9-%(5-) → -4
5%0 → 0
pow ^
negative exponent will result in a rational, but this behavior is subject to change and not officially supported, similarly for imaginary numbers
Num Num → Num
2^3 → 8
count =
count the number of times each element has occurred previously
[a] → [Num]
"abcaab" = → [0,0,0,1,2,1]
"ab","a","ab" count → [0,0,1]
sort !
O(n log n) sort - not optimized for lazy O(n) min/max yet todo
[a] → [a]
"atlas" ! → "aalst"
sortFrom !
stable O(n log n) sort - not optimized for lazy O(n) min/max yet todo
<a> [b] → [b]
3,1,4 ! "abc" → "bac"
"hi","there" ! (1,2,3) → [1,2]
"aaaaaa" ! "abcdef" → "abcdef"
chunk ?
chunk while truthy
[a] → [[a]]
"12 3"? → ["12","3"]
chunkFrom ?
chunk while first arg is truthy
<a> [b] → [[b]]
"11 1" ? "abcd" → ["ab","d"]
" 11 " ? "abcde" → ["","bc","",""]
()?"" → [""]
reshape #
Take elements in groups of sizes. If second list runs out, last element is repeated
[a] [Num] → [[a]]
[Num] [a (char)] → [[a]]
"abcdef"#2 → ["ab","cd","ef"]
"abc" # 2 → ["ab","c"]
"abcd" # (2,1) → ["ab","c","d"]
"."^10#2.5*" " → ".. ... .. ..."
2#"abcd" → ["ab","cd"]
"" # 2 → []
split /
split, keeping empty results (include at beginning and end)
Str Str → [Str]
"hi, yo"/", " → ["hi","yo"]
"abcbcde"/"bcd" → ["abc","e"]
"ab",*" "/"b "[2 → ["a","a"]
",a,,b,"/"," → ["","a","","b",""]
input $
all lines of stdin
→ <Str>
unmatched } }
next column from stdin
→ <Num>
let @
save to a variable without consuming it
a id → a
5@a+a → 10
push {
duplicate arg onto a lexical stack
a → a
5{,1,},2 → [5,1,5,2]
2{3+} → <4,5>
pop }
pop last push arg from a lexical stack
→ a
5{,1,},2 → [5,1,5,2]
flip \
reverse order of previous op's args
op/
2-\5 → 3
apply @
increase precedence, apply next op before previous op
@op
2*3@+4 → 14