3 ms·
And zippers are just beyond cool. You can formally take a derivative of data structure to find one. List is L(a) = 1 + a L(a) (≡ Nil or Cons(a, L(a)) L(a) = 1
by lelf 12y ago
And zippers are just beyond cool. You can formally take a derivative of data structure to find one.
List is L(a) = 1 + a L(a) (≡ Nil or Cons(a, L(a))
L(a) = 1/(1-a)
L'(a) = 1/(1-a)^2 = L(a)L(a) (≡ Pair of L(a) and L(a))
This is our zipper. One list holding for the tail and one list to remember how we get to where we are.
This one is trivial, but for e.g. trees it will be utterly fascinating.
- andrewflnr 12y agoThis series of articles goes into more detail: http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/ http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of... . He doesn't get to derivatives until the third part, but it's all (IMO) fascinating, and the concepts of the first two are necessary to understand the calculus part.
- TheLoneWolfling 12y agoWhy does 1/(1-a)^2 = L(a)L(a) ?