diff options
author | Rich Hickey <richhickey@gmail.com> | 2007-12-17 03:58:05 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2007-12-17 03:58:05 +0000 |
commit | 50fef0a99e560726fdc85c386f32869246e26ce9 (patch) | |
tree | 9112de29575af2c026e6029e35a48e43dcc52c8a /src | |
parent | 06d6a92e35bc4a28220fd561d6dbb7b684887240 (diff) |
added defstruct, struct, accessor
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.clj | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/boot.clj b/src/boot.clj index bf986cb3..6fd4678b 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -901,6 +901,15 @@ (macroexpand ex) ex))) +(defmacro defstruct [name & keys] + `(def ~name (. clojure.lang.PersistentStructMap (createSlotMap (list ~@keys))))) + +(defn struct [s & inits] + (. clojure.lang.PersistentStructMap (create s inits))) + +(defn accessor [s key] + (. clojure.lang.PersistentStructMap (getAccessor s key))) + (def *exports* '(clojure load-file eql-ref? @@ -945,5 +954,6 @@ max min bit-shift-left bit-shift-right bit-and bit-or bit-xor bit-not + defstruct struct accessor )) |