Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add defrecord-once

  • Loading branch information...
commit d3e5aa2c6ab4847e3d3cef0a3323372d4c4ebe4b 1 parent 74d1666
@ztellman authored
Showing with 9 additions and 1 deletion.
  1. +1 −1  project.clj
  2. +1 −0  src/potemkin.clj
  3. +7 −0 src/potemkin/protocols.clj
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject potemkin "0.1.4"
+(defproject potemkin "0.1.5-SNAPSHOT"
:description "Some useful facades."
:dependencies [[org.clojure/clojure "1.3.0"]]
:repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}
View
1  src/potemkin.clj
@@ -24,6 +24,7 @@
(import-macro protocols/defprotocol-once)
(import-macro protocols/deftype-once)
+(import-macro protocols/defrecord-once)
View
7 src/potemkin/protocols.clj
@@ -22,6 +22,13 @@
`(do)
(list* 'deftype name body)))
+(defmacro defrecord-once
+ "defonce for defrecord"
+ [name & body]
+ (if (resolve name)
+ `(do)
+ (list* 'defrecord name body)))
+
(defprotocol-once PotemkinMap
(keys* [this data]))
Please sign in to comment.
Something went wrong with that request. Please try again.