Friday, May 17, 2013

List forms

We can form bijections from a list of elements of some size to alternative representations for those lists. We can use this functionality to describe nesting structures to begin with:
(= (nesting '(def inc [x] (+ x 1)))
   '(0 1 [2] (3 4 5)))
We can use the catalan numbers to enumerate all binary bracketings of size n. Given such a nesting structure we can apply it back to a list:
(= ((nesting-function '((0 1) (2 3)) [10 20 30 40])
   '((10 20) (30 40)))
Matrices and grids use a special kind of nesting. Besides describing lists with nesting structures we can describe lists by associating indexes with keys in a hash.

No comments:

Post a Comment