Skip to content
pannous edited this page Sep 12, 2023 · 7 revisions

map = “data

The fundamental data type in Wasp is a tree of nodes, represented as nested map of maps.
Just like how in lisp everything is a list, in angle everything is a map.
Or internally: a node with parent, children and values.

Peter{address="Home 1"}

is internally represented as

Node{
 name="Peter"
 children={
   Node{
     name="address "
     value=Node{
         name="Home 1" 
         type=string
     }  
  }
}

null values are omitted

map functor

The map functor of other programing languages is not necessary because it is a first class citizen:

All functions are automatically broadcasting on lists and pair values:

square number=number*number
square [1 2 3] == [1 4 9]

square [a:1 b:2 c:3] == [a:1 b:4 c:9]

delete file := run `rm $file.name`
delete all files in ls /   # 🧐

Even though the map functor is part of angle, in 99% situations it should be superfluous via all/iteration as seen above.

similarly, applying a map is one of the most fundamental operations.
The rust match element map functor will be supported but may still be too verbose if used very often.
There is possibly ambiguity with adopting math notation though f={a:1 b:2} f(a) == 1. This MAY be resolved by reading f(a=2) and f(a) very differently, because in the current scheme f(a=2) == {a:2 b:3} or worse f(a=2)==3, because the last expression of the block is returned todo.

tree

A tree in wasp is just a nested map. The nodes may be keys or data.

lisps

It's obvious that one of the biggest shortcommings of classical lisps is that there is no standard first class citizen integration of maps.

However Clojure maps, Fennel tables and Janet structs/tables at least partially address this issue:

https://clojure.org/guides/learn/hashed_colls#_maps

https://fennel-lang.org/tutorial#tables

https://janet-lang.org/docs/data_structures/structs.html

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally