wiki:DataStructures

Version 3 (modified by schiptsov, 9 years ago) ( diff )

--

To keep it simple, we can thing of data structures according its shape. There are

  • list - a sequence of the values of the same type (an array) or of any type (a set)
  • table - of the values of the same type (matrix or multidimensional array) or of mixed types an associative list (alist) or an associative array or a hash table
  • tree - trees of any kind, such as binary trees, binary-search trees, red-black trees, etc.
  • net - a graph or a network with any kind connections between its nodes.

use annotations for the compiler to choice appropriate built-in primitives.

cons:

(a . b)

list (could be annotated as a set, one-dimension array, etc)

(1 "two" 3 (4 5))

(1 . ("two" . (3 . (4 . ((5 . nil) nil))))

vecror:

((1)
 (2)
 (3))

matrix:

((1 2 3)
 (3 4 5)
 (6 7 8))

associative array:

(("a" . 1)
 ("b" . 2)
 ("c" . '(1 2 3)))

hash table:

table could be "called" by sending a message (t "orange") => 2

(("apple" . 1)
 ("orange" . 2)
 ("grapes" . 3))
Note: See TracWiki for help on using the wiki.