6 ms·
The LISP people were right to make trees essentially a first class data structure.
by i2cmaster 3y ago
The LISP people were right to make trees essentially a first class data structure.
- mbork_pl 3y agoLists, technically, but nestable lists are indeed basically trees.
- singularity2001 3y agoThe problem with lists as tree is that there is no universal way to distinguish a:{ b c:d } from a:{ b:(c d) } which is why we need proper maps as first class citizen for "the next lisp"
- kaliszad 3y agoClojure does have maps as a first class citizen (besides sets, vectors and lists). Then there is clojure.walk and other namespaces suitable for tree manipulation. https://clojure.org/api/cheatsheet https://clojure.org/api/cheatsheet Using trees of these collections is quite customary in Clojure - on the front-end you might keep the application state in a single atom, like re-frame does and update various branches of it using events/ effects and listening on changes to those branches using subscriptions. This approach work for us at orgpad.com quite well.
- singularity2001 3y agoYet what we really need is nested MAPS as first class data structure: a{ nested:tree with:{lots-of:data and:more}}
- maleldil 3y agoSee Clojure maps, Fennel tables and Janet structs/tables. https://clojure.org/guides/learn/hashed_colls#_maps https://clojure.org/guides/learn/hashed_colls#_maps https://fennel-lang.org/tutorial#tables https://fennel-lang.org/tutorial#tables https://janet-lang.org/docs/data_structures/structs.html https://janet-lang.org/docs/data_structures/structs.html