Skip to content

1.1.0

Choose a tag to compare

@clueless-skywatcher clueless-skywatcher released this 22 Mar 12:59
· 54 commits to master since this release
147163d

FlameMath v1.1.0 — Quality of Life & Completeness

Language Features

  • Line comments — // comments are now supported. Everything after // until the end of the line is
    ignored.
    x = 5 // assign x
  • For loop — Iterate over a list with For(var, list, body). The loop variable is scoped to the body
    and does not leak.
    For(i, [1, 2, 3], PrintLn(i))
  • Variadic arguments — Lambdas now support rest parameters with ... syntax. The rest parameter
    collects remaining arguments into a list.
    F = (first, ...rest) => rest
    F(1, 2, 3, 4) → [2, 3, 4]
  • Variadic clauses work with overloaded dispatch — non-variadic clauses are matched first, variadic
    clauses serve as fallback.

New Functions

List Functions (builtins)

  • Sort(list) — Sort elements in ascending order. Supports an optional comparator: Sort(list, (a, b) =>
    ...).
  • Slice(list, start, end) — Extract a sublist from index start (inclusive) to end (exclusive).

List Functions (stdlib)

  • Reverse(list) — Reverse the elements of a list.
  • Flatten(list) — Recursively flatten nested lists into a single list.
  • Zip(list1, list2) — Combine two lists element-wise into a list of pairs.
  • Outer(f, list1, list2) — Compute the outer product by applying f to all combinations.

String Functions (builtins)

  • StrJoin(list, sep) — Join a list of strings with a separator.
  • SubStr(str, start, end) — Extract a substring.
  • StrSplit(str, sep) — Split a string by a separator into a list.

Math (stdlib)

  • Min(list) / Max(list) — Find the minimum or maximum of a list. Also work with two arguments.
  • Product(list) — Compute the product of all elements in a list.