Lit | Bin | Desc | Arg Types | Autos | Example | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | integer |
| 3 → 3 | ||||||||
" | 2 | string |
| "hi\n" → "hi\n" | |||||||
' | d2 | char |
| 'b' → 'b' | |||||||
$ | 3 | 1st arg | ;1;2;3 $ → 1,2,3,3 | ||||||||
@ | 4 | 2nd arg | ;1;2;3 @ → 1,2,3,2 | ||||||||
_ | 5 | 3rd arg | ;1;2;3 _ → 1,2,3,1 | ||||||||
; | 6 | save |
| + ;3 $ → 6 | |||||||
: | 7 | append |
|
| :"abc" "def" → "abcdef" | ||||||
] | 8 | max |
|
| ]4 5 → 5 | ||||||
+ | 8 | add |
|
| +2 1 → 3 | ||||||
[ | a | min |
| [4 5 → 4 | |||||||
* | a | multiply |
|
| *7 6 → 42 | ||||||
- | 9 | subtract |
|
| - 5 3 → 2 | ||||||
/ | b | divide |
|
| /7 2 → 3 | ||||||
% | c | modulus |
|
| %7 2 → 1 | ||||||
^ | e | pow (minus is nth root) |
|
| ^2 8 → 256 | ||||||
+ | 8 | sum |
| +,3 → 6 | |||||||
+ | 8 | concat |
| +.,3,$ → [1,1,2,1,2,3] | |||||||
. | c | map |
| ."abc"+1$ → "bcd" | |||||||
| | 9 | filter |
|
| |,5%$2 → [1,3,5] | ||||||
! | 9 | zip with |
| ! ,3"abc" + → "bdf" | |||||||
/ | a | foldr1 |
| /,3+@$ → 6 | |||||||
/ | a | foldr |
|
| /,3 1 +@$ → 7 | ||||||
\ | b | reverse |
| \,3 → [3,2,1] | |||||||
, | d | length |
| ,"asdf" → 4 | |||||||
< | b | take ( `< also drop) |
|
| <3"asdfg" → "asd" | ||||||
> | c | drop ( `> also take) |
|
| >3,5 → [4,5] | ||||||
, | d | range 1.. ( `, is 0...) |
|
| ,3 → [1,2,3] | ||||||
^ | e | replicate |
|
| ^3"ab" → "ababab" | ||||||
= | 9 | subscript (wrapped) |
|
| =2 "asdf" → 's' | ||||||
? | f | index (or 0 if not found) |
|
| ? "abc" 'b' → 2 | ||||||
- | f | diff |
| -"abcd" "bd" → "ac" | |||||||
% | 8 | split (remove empties) |
|
| %"a b c" " " → ["a","b","c"] | ||||||
* | 8 | join |
| *" ",3 → "1 2 3" | |||||||
& | 8 | justify |
|
| & " " 4 "hi" → " hi" | ||||||
\ | a | char class? |
| |"a.c d" \$a → "acd" | |||||||
o | e | ord |
| o'd' → 100 | |||||||
? | f | if/else |
|
| ? 0 "T" "F" → "F" | ||||||
; | 6 | hidden save before EOF |
| → | |||||||
/ | a | hidden foldr1 EOF |
| → | |||||||
`/ | 9 d | divmod |
|
| `/7 2 $ → 3,1 | ||||||
`% | b d | moddiv |
|
| `%7 2 $ → 1,3 | ||||||
`r | f 1 | read int |
| `r"12" → 12 | |||||||
?, | fd | if/else (lazy list) |
|
| ?, "cond" 1 0 → 1 | ||||||
>> | c0 | tail |
| >>,5 → [2,3,4,5] | |||||||
<< | b0 | init |
| <<"asdf" → "asd" | |||||||
`( | e 1 | uncons |
| `( ,3 $ → 1,[2,3] | |||||||
`) | e 2 | swapped uncons |
| `) ,3 $ → [2,3],1 | |||||||
`/ | be | chunks of |
|
| `/2,5 → [[1,2],[3,4],[5]] | ||||||
`\ | de | n chunks |
|
| `\ 2 ,6 → [[1,2,3],[4,5,6]] | ||||||
`% | bc | step |
|
| `%2,5 → [1,3,5] | ||||||
`? | e a | find indices [by] |
|
| `? "a b" \$a → [1,3] | ||||||
`= | b9 | chunk by |
| `= ,5 /$2 → [[1],[2,3],[4,5]] | |||||||
=~ | bc | group by (also sorts) |
|
| =~ "cabcb" $ → ["a","bb","cc"] | ||||||
or | bc | or |
|
| or"" "b" or "a" "c" → "b","a" | ||||||
`< | e d | sort |
| `<"asdf" → "adfs" | |||||||
`' | e 3 | transpose |
| `' "hi""yo" → ["hy","io"] | |||||||
=\ | dc | scanl1 |
| =\,3+*2$@ → [1,5,11] | |||||||
=\ | dc | scanl |
|
| =\,3 0 +@$ → [0,1,3,6] | ||||||
`\ | e c | special scans |
| `\ ,4 + → [1,3,6,10] | |||||||
`/ | e b | special folds |
| `/ "asdf" ] → 's' | |||||||
`* | 90 | product |
| `*,4 → 24 | |||||||
`_ | cc | subsequences |
|
| `_ 2 "abc" → ["ab","ac","bc"] | ||||||
`* | 90 | nary cartesian product |
| *" "`*"ab""cd" → "ac ad bc bd" | |||||||
``p | b80 | permutations |
| ``p "ab" → ["ab","ba"] | |||||||
`: | e 8 | list of 2 lists |
| `: ,2 ,1 → [[1,2],[1]] | |||||||
`- | e 8 | list difference [by] |
|
| `- "aabd" 'a' → "abd" | ||||||
`& | e 5 | list intersection [by] |
|
| `& "abaccd" "aabce" → "abac" | ||||||
`| | e 6 | list union [by] |
|
| `| "abccd" "aabce" → "abccdae" | ||||||
`^ | e 7 | list xor [by] |
|
| `^ "aabce" "abbde" → "acbd" | ||||||
`$ | e 4 | uniq |
| `$ "bcba" → "bca" | |||||||
!= | c0 | abs diff |
|
| != 3 5 → 2 | ||||||
`& | c0 | bit intersection |
|
| `& 6 3 → 2 | ||||||
`| | b0 | bit union |
|
| `| 3 6 → 7 | ||||||
`^ | b0 | bit xor |
|
| `^ 6 3 → 5 | ||||||
| | 9 | partition |
|
| |,5~~%$2 $ → [1,3,5],[2,4] | ||||||
%~ | e 0 | split by |
|
| %~"a b"$ → [("a",""),("b"," ")] | ||||||
`% | f1 | split list (keep empties) |
|
| `% ,5 :3 4 → [[1,2],[5]] | ||||||
-~ | 90 | strip |
| -~ " bcd\n\n" → "bcd" | |||||||
`$ | d7 | signum |
| `$ -2 `$ 0 `$ 2 → -1,0,1 | |||||||
`) | c 2 | to uppercase |
| `) 'a' → 'A' | |||||||
`( | c 7 | to lowercase |
| `( 'A' → 'a' | |||||||
ch | dd | chr |
|
| ch 100 → 'd' | ||||||
`p | f1 | int to str |
| `p 5 → "5" | |||||||
``@ | d70 | to bits |
| ``@ 10 → [1,0,1,0] | |||||||
hex | b02 | to/from hex |
| hex 31 → "1f" | |||||||
`D | 800 | to base from data |
| `D 2 10 → [1,0,1,0] | |||||||
`@ | 87 | to base |
|
| `@ 2 10 → [1,0,1,0] | ||||||
`@ | b0 | from base |
|
| `@ 2 :1 :0 :1 0 → 10 | ||||||
`. | b2 | iterate while uniq |
|
| `. 10 %+1$3 → [10,2,0,1] | ||||||
.~~ | 900 | append until null |
| .~~,3,-/$$1 → [1,2,3,1,2,1] | |||||||
;~ | 60 | save fn |
| ;~2+1$ $4 → 3,5 | |||||||
== | 60 | equal? |
| == 1 2 == 1 1 → 0,1 | |||||||
`; | 66 | recursion (alt name ``; ) |
| `; 5 $ 1 *@-$~$ → 120 | |||||||
`# | f0 | hashmod |
|
| ."Fizz""Buzz" `# $ 6 1a → [3,5] | ||||||
fsb | find salt by |
|
| fsb"Fizz""Buzz"6~==$ :3 5 → "1a" | |||||||
fs | find salt |
|
| fs "Fizz""Buzz"6~ :3 5 → "1a" | |||||||
pt | debug arg type |
| pt 5 → error"Integer" | ||||||||
p | show |
| p"a" → "\"a\"" | ||||||||
ct | debug context types | ;5 ct → error"$ :: Integer ..." | |||||||||
let | let statement | let x +5 4 *x x → 81 | |||||||||
\ | lambda (only in fns) | /,3 \e a +a e → 6 | |||||||||
sets | name extras (; ok) | `/ 10 3 sets a a → 3,1 | |||||||||
error | fd02 | error |
| error +2 1 → error "3" | |||||||
~ | 0 | hidden auto value | → | ||||||||
: | 7 | hidden singleton |
| → | |||||||
=~ | d8 | hidden subscript no wrap |
| → | |||||||
| | 9 | hidden filter not (done here rather than using AutoNot to allow for a const expression. There isn't a useful behavior for ~ in zipWith |
|
| → | ||||||
/ | a | hidden foldr init tuple |
| → | |||||||
/ | a 3 | hidden foldr1 $, needed because normally foldr1 needs to know if size 1 or 1+ to determine if f will be called on anything, but in this case, it doesn't matter, so this is lazier... The best way to actually fix this would be to call foldr with an initial value of "identity" which is a special value that when used in a binary op always returns the other value. |
| → | |||||||
`, | b7 | hidden range from 0 ... |
|
| → | ||||||
? | f | hidden index by |
|
| → | ||||||
* | hidden join str str error |
| → | ||||||||
`<~ | e 9 | hidden take drop while |
|
| → | ||||||
<~ | e f | hidden take while |
|
| → | ||||||
`>~ | c00 | hidden drop take while |
|
| → | ||||||
>~ | e e | hidden drop while |
|
| → | ||||||
`< | b8 | hidden take drop |
| → | |||||||
`> | c0 | hidden drop take |
| → | |||||||
`? | e a | hidden find indices |
|
| → | ||||||
=\ | dc | hidden scanl init tuple |
| → | |||||||
.>> | hidden warning for map on tail |
| → | ||||||||
\>> | hidden warning for reverse tail |
| → | ||||||||
tbd | dd | hidden tbd |
|
| → | ||||||
``; | a00 | hidden recursion alt (because ;; might be invalid if arg is $ @ _) |
| → |
symbol | meaning |
---|---|
{type} | parse a value of that type (not an expression, saves a nibble though) |
any* | any type or ~ for a tuple |
>type | this argument must be longer in length than the preceding (for commutative extensions) |
vec | same as "any" but used to denote that it will vectorize if a list is given |
num | int|chr |
[*] | list of any type |
[a] | list of type variable "a" |
reqfn | fn but its argument must be used |
const | fn but its argument must not be used (for extensions) |
fn? | auto ~ means to take an extra fn argument here |
itatlic | auto ~ specifies "option present" but does not replace the arg |
chclass | zipop | foldop | |||
---|---|---|---|---|---|
a | isAlpha | ] | max | ||
A | not.isAlpha | [ | min | ||
n | isAlphaNum | + | add | ||
N | not.isAlphaNum | * | mult | ||
s | isSpace | - | sub | ||
S | not.isSpace | / | div | ||
l | isLower | % | mod | ||
L | not.isLower | ^ | pow | ||
u | isUpper | : | cons | ||
U | not.isUpper | ~ | by | | | or |
p | isPrint | , | make tuple | & | and |
P | not.isPrint | ! | abs diff | ; | rev cons |
d | isDigit | = | subscript | > | max by fn |
D | not.isDigit | ? | index | < | min by fn |
$ | isSym | ||||
! | not.isSym |
sym* | type | name | default |
---|---|---|---|
$ | int | fstInt | 100 |
@ | str | fstLine | printable chars |
_ | [int] | ints | [] |
;$ | int | sndInt | 1000 |
;@ | [str] | allLines | [] |
;_ | str | allInput | "" |
;;$ | [[int]] | intMatrix | [] |
;;@ | str | sndLine | "" |
* command args can be of any type and precede these (use Haskell syntax) |
1st type | arg used | meaning |
---|---|---|
int | $ or @ | range |
list | @ | foldl |
list | $ | map |
~ | encode data |