Skip to content
jy edited this page Aug 9, 2023 · 2 revisions

Values

Also see Concept

Numbers can have a decimal point or not, but must have at least one digit before the decimal point, i.e.

code can parse
1 ✔️
1. ✔️
0.1 ✔️
.1

Sets can have nothing [] or, numbers or sets as items [1, [1, 2]], separated by comma, trailing comma is allowed.

Identifiers take A-Za-z, $ and _.

There's also boolean true and false but it's only ever used in description set.

For example, [true] is a description set that's always true, setting no restriction on what the items can be, essential a set that has everything.

This is just my personal convention but I added $ to accepted identifier character because I use it to mean element in a description set. You can use any other name.

Calculation

Also see Concept

Boolean operators and set operators both go between the only two arguments.

Unary go before.

Functions will always have at least 1 argument before the arrow ->. Then maybe some arguments in the parenthesis value->func(n, m, o), arguments are separated by comma, trailing is again allowed.

The operator precedence is, from most prioritized to least, unary > function > set operations > boolean operations.

For example

[1, 2] -> offset(0.5) & [3, 4] -> div(2) has 2.5

Parses as

  graph BT;
      R[1, 2]-->T;
      S[0.5]-->T[offset];
      U[3, 4]-->W;
      V[2]-->W[div];
      T-->X;
      W-->X[&];
      X-->Z;
      Y[2.5]-->Z[has];
Loading

You can also use parenthesis to make something execute first.

Loop & Control Flow

The only thing that loops here is enum, it takes the value before it, make a copy, and then pop elements out of the copy one by one until it only has a empty set. This does NOT alter the original set. (description set can't be enumerated)

enum is always used with parenthesis and at least a nickname for the items

set enum(i)
    i -> print

You can also access the copy of the set that's being looped by giving it a nickname, that's an identifier after the nickname for item

set enum(i, ref)
    ref -> print

The fact that enumerating an empty set doesn't execute its block can be used as a budget if-else

willExecute = 1
willExecute enum(i)
    1 -> print

wontExecute = []
wontExecute enum(i)
    1 -> print

Clone this wiki locally