Temporary syntax:
```
for a initially 0 and then (a + x) for x among lst
```
and in French:
```
pour a initialement 0 puis (a + x) pour x parmi lst
```
to be elaborated with the Syntax Committee of course. Two new keywords:
`initially` and `and then` (it could have been the existing `then` keyword for
english, relying on the ambiguity of the word, but that's not portable across
languages).
Then added to the cheat-sheet and docs.
Note that detuplification takes place, making it possible both to fold multiple
lists in parallel, and to use multiple accumulators. See the tests for examples.
Closes#592
A new node is added in `desugared`, and translated into an exploded structure
literal during translation to `scopelang`. The main reason to put it there is
that it needs to be after disambiguation, since that is used to discover the
type of the structure that is being updated.
Define a single expression rule with disambiguation using token priorities
instead of the many layers of intermediate rules with explicit sub-terms.
Also replaces `in` for collection operations (`x+1 for foo in [1;2]`) with
`among` which helps a lot.
This uses the same disambiguation mechanism put in place for
structures, calling the typer on individual rules on the desugared AST
to propagate types, in order to resolve ambiguous operators like `+`
to their strongly typed counterparts (`+!`, `+.`, `+$`, `+@`, `+$`) in
the translation to scopelang.
The patch includes some normalisation of the definition of all the
operators, and classifies them based on their typing policy instead of
their arity. It also adds a little more flexibility:
- a couple new operators, like `-` on date and duration
- optional type annotation on some aggregation constructions
The `Shared_ast` lib is also lightly restructured, with the `Expr`
module split into `Type`, `Operator` and `Expr`.
Before: `ELEMENT in SET`; now: `SET contains ELEMENT`
Using the `in` keyword was causing conflicts and blocking #203.
Current proposal has `contient` for the French syntax, and is untranslated (`contains`) for Polish.