mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-08-15 06:40:25 +03:00
Add tree syntax to syntax.md
This commit is contained in:
parent
43f9d77968
commit
b20a126768
@ -622,6 +622,18 @@ A List literal is surrounded by `[` `]`. The elements must be separated by `,`.
|
||||
|
||||
It is desugared to constructor calls of the built-in type List, `List/cons(head, ~tail)` and `List/nil` .
|
||||
|
||||
### Tree Literals
|
||||
|
||||
```python
|
||||
![![1, 2], ![3, 4]]
|
||||
```
|
||||
|
||||
The Tree literals `![]` and `!` are used to create values of the built-in type `Tree`.
|
||||
|
||||
`![a b]` is equivalent to `Tree/Node(a, b)`.
|
||||
|
||||
`!x` is equivalent to `Tree/Leaf(x)`.
|
||||
|
||||
### Map Literals
|
||||
|
||||
```python
|
||||
@ -1131,6 +1143,18 @@ The syntax above is desugared to:
|
||||
|
||||
Using `,` is optional.
|
||||
|
||||
### Tree Literals
|
||||
|
||||
```python
|
||||
![![1, 2], ![3, 4]]
|
||||
```
|
||||
|
||||
The Tree literals `![]` and `!` are used to create values of the built-in type `Tree`.
|
||||
|
||||
`![a b]` is equivalent to `Tree/Node(a, b)`.
|
||||
|
||||
`!x` is equivalent to `Tree/Leaf(x)`.
|
||||
|
||||
### Nat Literal
|
||||
|
||||
```rust
|
||||
|
Loading…
Reference in New Issue
Block a user