Mentions légales du service

Skip to content

Fix #11: flexible ranges

Thierry Martinez requested to merge fix.11.flexible_ranges into main

This commit introduces a more intuitive syntax for ranges, allowing the user to write [0 .. 4] or expressions such as:

  • (l[0] + .. + l[len(l) - 1]) / len(l) to compute the mean of l, or

  • n * (n - 1) * .. * 1 (to compute n!).

See README.md for more details on the allowed syntax.

The commit contains a large part of refactoring to split values representation between FrontValue for values constructed by the parser, and Value for "desugared" values, transformed by a preprocessing phase in ast.rs. This refactoring opens the way for introducing other syntactic sugars.

Edited by Thierry Martinez

Merge request reports