-
Notifications
You must be signed in to change notification settings - Fork 46
Quicks
Alexander Liao edited this page Mar 5, 2020
·
33 revisions
From the Tutorial:
Jelly link definitions are composed, at the lowest level, of tokens, and the Jelly parser pushes them to a list of chains when parsing your program. Certain tokens, however, have a very special meaning: they’re commands to the parser itself, either pushing a special value to the current chain, or operating on the links most recently pushed to the chain being parsed – somewhat like parse-time postfix operators.
For now this is just a list of quicks, an explanation will be added later.
Symbol | Description | Syntax |
---|---|---|
© |
Copy link result to register (® atom to retrieve). |
<link>© |
ß |
This link, with the same arity. | ß |
¢ |
Last link as a nilad. | ¢ |
Ç |
Last link as a monad. | Ç |
ç |
Last link as a dyad. | ç |
Ñ |
Next link as a monad. | Ñ |
ñ |
Next link as a dyad. | ñ |
£ |
Link at index n as a nilad. | <index>£ |
Ŀ |
Link at index n as a monad. | <index>Ŀ |
ŀ |
Link at index n as a dyad. | <index>ŀ |
¦ |
Apply link to items at specific indices. | <link><indices>¦ |
¡ |
Repeat n times. | <link><repetitions>¡ |
¿ |
While loop. | <body><condition>¿ |
/ |
Reduce or n-wise reduce. |
<dyad>/ or <dyad><nilad>/
|
ƒ |
Reduce or n-wise reduce using the right argument as the starting value. |
<dyad>ƒ or <dyad><nilad>ƒ
|
\ |
Cumulative reduce or n-wise overlapping reduce. |
<dyad>\ or <dyad><nilad>\
|
¤ |
Nilad followed by links as a nilad. | |
$ |
Last two links (if not part of an LCC) as a monad | |
Ɗ |
Last three links (if not part of an LCC) as a monad | |
Ʋ |
Last four links (if not part of an LCC) as a monad | |
¥ |
Last two links (if not part of an LCC) as a dyad | |
ɗ |
Last three links (if not part of an LCC) as a dyad | |
ʋ |
Last four links (if not part of an LCC) as a dyad | |
# |
nfind : Count up, collecting first n matches. |
<condition><amount># |
? |
Ternary if. | <if-clause><else-clause><condition>? |
Ƒ |
Check if the left argument is equal to the result. | <link>Ƒ |
⁺ |
Duplicates the previous link. | |
@ |
Swaps operands. | <dyad>@ |
` |
Make a monad from a dyad by repeating the argument. | <dyad>` |
" |
Vectorize/zipwith. | <dyad>" |
' |
For monads, flat. For dyad, spawn. | <monad/dyad>' |
þ |
Outer product/table. | <dyad>þ |
{ |
Turn a monad into a dyad. Uses the left argument. | <monad>{ |
} |
Turn a monad into a dyad. Uses the right argument. | <monad>} |
€ |
Each. Map a link over its left argument. | <monad/dyad>€ |
Þ |
Sort by some key function. | <monad>Þ |
Ɲ |
Apply a dyadic link or a monadic chain for all pairs of neighboring elements. | <any>Ɲ |
Ƥ |
Map a link over prefixes, and if given a <nilad> , overlapping infixes if positive, or the overlapping outfixes of abs(<nilad>) if negative. |
<monad>Ƥ or <monad><nilad>Ƥ
|
ƙ |
Key. Map a link over the groups formed by identical items. | <monad>ƙ |
ɼ |
Register. Apply link to ® then copy to the register and return the result. |
<link>ɼ |
ƭ |
Tie. Cycle through a number of (default 2) links each time called. |
<links...><nilad>ƭ or <link><link>ƭ
|
Ɱ |
Each (alias for Ѐ ). Map a link over its right argument. |
<dyad>Ɱ |
С |
Like ¡ . Collects all intermediate results. |
|
п |
Like ¿ . Collects all intermediate results. |
|
ÐƤ |
Map a link over suffixes, and if given a <nilad> , non-overlapping infixes if positive, or the non-overlapping outfixes of abs(<nilad>) if negative. |
<monad>ÐƤ or <monad><nilad>ÐƤ
|
Ƈ |
Filter (alias for Ðf ). Keep all items that satisfy a condition. |
<condition>Ðf |
Ðḟ |
Filter. Discard all items that satisfy a condition. | <condition>Ðḟ |
ÐL |
Loop. Repeat until the results are no longer unique. | <link>ÐL |
Ƭ |
Like ÐL (alias for ÐĿ ). Collects all intermediate results. |
|
ÐḶ |
Like ÐL . Collects all results in the loop. |
|
ÐṂ |
Keep elements with minimal link value; [e for e in z if link(e) == min(map(link, z))] . |
<link>ÐṂ |
ÐṀ |
Keep elements with maximal link value; [e for e in z if link(e) == max(map(link, z))] . |
<link>ÐṀ |
Ðe |
Apply link to even indices. | <link>Ðe |
Ðo |
Apply link to odd indices. | <link>Ðo |