Skip to content

Instantly share code, notes, and snippets.

@nathanmarz
Created February 16, 2016 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanmarz/9981c0b04e712d460a21 to your computer and use it in GitHub Desktop.
Save nathanmarz/9981c0b04e712d460a21 to your computer and use it in GitHub Desktop.
Integrate zippers with Specter
(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