Skip to content

Instantly share code, notes, and snippets.

@jcf
Created June 10, 2015 15:12
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 jcf/fb9769ff5e9b5453bd8a to your computer and use it in GitHub Desktop.
Save jcf/fb9769ff5e9b5453bd8a to your computer and use it in GitHub Desktop.
Prismatic schema for reference-types (deferrable) like atoms and futures.
(defrecord Reference [schema]
s/Schema
(walker [_]
(let [sub-walker (s/subschema-walker schema)]
(fn [x] (sub-walker @x))))
(explain [_] (list 'reference (s/explain schema))))
(defn reference
[schema]
(Reference. schema))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment