node - pannous/warp GitHub Wiki

Data in Angle is node / map based.

The fundamental data type in Angle is a node, which may have a value or children, thus acting as list or map!

Just like how in lisp everything is a list, in angle everything is a map.

Or internally: a node with internal kind, parent, children and values.

Peter{address="Home 1"}

is internally represented as

# sketch: a nested node (cut short)
Node{
 name="Peter"
 children={
   Node{
     name="address "
     value=Node{
         name="Home 1" 
         type=string
     }  
  }
}

Nodes acting as lists and maps simultaneously may feel a bit unfamiliar for developers of other languages but it becomes natural after a while: {a:b c:d} => a(value:b next:c(value:d))

The value property can hold many different types and will soon be unified with the children property:

{a{b c} d:e} => a(children:[b c] next:d(value:e)) => {a{b c} d:e} => a(value:(b next:c) next:d(value:e))

Nodes from warp code

data … keeps code as a node instead of running it; warp code reads its parts and builds new ones:

p = data (x: 3)
[p.key, p.value, p.op, p.name]   // [x 3 ":" "x"]
c = data f(1, 2)
c.bracket                        // "("

symbol("x"), key(left, op, right) and bracketed(items, "(") build nodes; a list keeps its separator (commas = data [a, b] gives commas.separator ","), and separated(list, ";") sets another. A built list equals the written one: bracketed([1, 2], "(") == (1, 2) and separated([1, 2], ";") == [1; 2] are true.