Created
February 16, 2016 16:36
-
-
Save nathanmarz/9981c0b04e712d460a21 to your computer and use it in GitHub Desktop.
Integrate zippers with Specter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns specter.zip | |
(:use [com.rpl.specter.macros :only [defpath]] | |
[com.rpl specter]) | |
(:require [clojure [zip :as zip]])) | |
(def VECTOR-ZIP (view zip/vector-zip)) | |
(def NEXT (view zip/next)) | |
(def RIGHT (view zip/right)) | |
(def LEFT (view zip/left)) | |
(def DOWN (view zip/down)) | |
(def UP (view zip/up)) | |
(defpath NODE [] | |
(select* [this structure next-fn] | |
(next-fn (zip/node structure)) | |
) | |
(transform* [this structure next-fn] | |
(zip/root (zip/edit structure next-fn)) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment