-
-
Notifications
You must be signed in to change notification settings - Fork 4
grouping
Angle is build on core principles: The wasp data format has multible layers of grouping to create high dimensional data or separate nested code blocks:
lists can be formed with all enclosing symbols '()' '[]' '{}' and grouping characters :
- space ' '
- comma ','
- semicolon ';'
- pipe '|',
- tab '\t'
- newline '\n'
items=1,2,3
items=1;2;3
items=1 2 3
items=(1 2 3)
items=[1,2,3]
items={1;2;3}
items={
a
b
c
}
etc …
The pipe operator has special semantics
This universal grouping principle might seem like superfluous ambivalence at first, but becomes very handy to form nested higher order arrays, maps, matrices, tensors etc:
m=(1 2; 3 4)
Since all 6 grouping separators above (" ,;|\t\n") have increasing precedence, in theory one could easily write six dimensional data in wasp. Practically this hierarchy leaves room to include list into other lists.
Say you have a heterogenous list of objects
items={1;'a';bob}
you can just add a list with minimal syntax items={1;'a';bob; 1,2,3}
.
What is the benefit compared to wrapping every list in their own brace (as in lisp)?
One might say this is subjectively a matter of taste:
(let
((F1 (fibonacci (- N 1)))
(F2 (fibonacci (- N 2))))
(+ F1 F2))
Objectively it increases readability if each layer in the hierarchy has their own sigil. '))))' tells us nothing about which layer is being closed.