-
Notifications
You must be signed in to change notification settings - Fork 46
Syntax
Dylan Rees edited this page Jun 15, 2018
·
12 revisions
From the Tutorial:
Jelly uses its own 256-byte code page. Most of the characters in it are allocated for built-in atoms, but some of them have special semantics.
For now, this is just a list of Jelly syntax characters. An explanation will be added later.
Literal digits together are not added individually, but as a single number. 23
is the nilad 23. Use spaces to separate tokens 2 3
for 2, then 3. Leading 0
s are counted as separate literals, e.g. 00103
is the same as 0 0 103
.
Symbol | Description |
---|---|
|
Token separator. |
0 |
The literal 0. |
1 |
The literal 1. |
2 |
The literal 2. |
3 |
The literal 3. |
4 |
The literal 4. |
5 |
The literal 5. |
6 |
The literal 6. |
7 |
The literal 7. |
8 |
The literal 8. |
9 |
The literal 9. |
The following is a simple description of string literals. A more complete description can be found in the tutorial.
Symbol | Description | Syntax |
---|---|---|
“ |
Begins a string literal, and separates a list of strings inside a string literal. | “12“34” |
” |
Terminates a regular string or a list of strings. Without “ , a character literal. |
“1234” |
» |
Terminates a dictionary-compressed string. | “1234» |
‘ |
Terminates a code-page index list. Jelly's version of ord() . |
“12“34‘ |
’ |
Terminates a base-250 number. | “1234’ |
⁾ |
Begins a 2-char string literal. | ⁾12 |
⁽ |
Begins a 2-digit base-250 number. If the number is larger than 31500, subtracts 62850, otherwise adds 750. | ⁽12 |
Symbol | Description | Syntax |
---|---|---|
<newline> or ¶
|
Starts a new link. | <link><newline><line> |
ø |
Starts a separate niladic chain. | ø<link> |
µ |
Starts a separate monadic chain. | µ<link> |
) |
Equivalent to µ€ . Maps the chain to the left over its left argument. Unlike µ , the chain following ) retains the same left argument as the chain popped by ) . |
<link>) |
ð |
Starts a separate dyadic chain. | ð<link> |
ɓ |
Starts a separate dyadic chain with reversed arguments. | ɓ<link> |
ı |
Complex number. Without arguments, 1j . |
xıy |
ȷ |
Decimal number, as in 2e6 for 2000000 . Without arguments, 1000 . |
xȷy |
- |
Negative number. Without arguments, -1 . |
-5 |
. |
Decimal number. Without arguments, 0.5 . |
1.2 |
, |
Separate elements of a list. If any of the arguments is not a literal, or spaces separate the arguments, , will be treated as the "pair" atom instead. |
x,y |
[ |
Begins a comma-separated list. Note that [] doesn't work as the empty list, use “” or ⁸ instead. |
[2] |
] |
Ends a comma-separated list. | [2] |