This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
forked from DennisMitchell/jellylanguage
-
Notifications
You must be signed in to change notification settings - Fork 0
Quicks
Έρικ Κωνσταντόπουλος edited this page Feb 18, 2017
·
1 revision
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>/
|
\ |
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 two 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>? |
⁺ |
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>Þ |
Ѐ |
Each. Map a link over its right argument. | <dyad>Ѐ |
С |
Like ¡ . Collects all intermediate results. |
|
п |
Like ¿ . Collects all intermediate results. |
|
Ðf |
Filter. 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 . 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>ÐṀ |
The wiki is best viewed with this user script.