Re: zipper: missing down-right

2009-01-29 Thread Christophe Grand
Rather than 'down-right, I now prefer 'rightmost (first you go down then you go to the rightmost child): (defn rightmost "Returns the loc of the rightmost sibling of the node at this loc, or self" [loc] (let [[node {l :l r :r :as path}] loc] (when (and path r) (with-meta

zipper: missing down-right

2009-01-27 Thread Christophe Grand
I keep needing to go to the last (rightmost) child of a loc (generally after appending it). (Or I failed to spot the proper idiom.) So I wrote last-child: (defn last-child [loc] (last (take-while identity (iterate zip/right (zip/down loc) but it feels a bit overkill because of all thi