Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't depend on stolen copy of name-with-attributes

  • Loading branch information...
commit 5dd8d835a3bd0ecb531c2a3c730ccfdc9187d98b 1 parent 4d74158
@amalloy amalloy authored
Showing with 1 addition and 28 deletions.
  1. +1 −2  src/useful/experimental.clj
  2. +0 −26 src/useful/macro.clj
View
3  src/useful/experimental.clj
@@ -2,7 +2,7 @@
(:use [useful.utils :only [split-vec]]
[useful.seq :only [alternates]]
[useful.map :only [keyed]]
- [useful.macro :only [name-with-attributes]]
+ [clojure.tools.macro :only [name-with-attributes]]
[useful.fn :only [any]]))
(defn comp-partial
@@ -214,4 +214,3 @@
set of wrappers."
[wrappers-var wrap-fn & body]
`(with-wrappers ~wrappers-var [~wrap-fn] ~@body))
-
View
26 src/useful/macro.clj
@@ -60,32 +60,6 @@ myconst 10)."
([name orig doc]
(list `defalias (with-meta name (assoc (meta name) :doc doc)) orig)))
-;; name-with-attributes by Konrad Hinsen, stolen from c.c.def:
-(defn ^{:dont-test "Stolen from contrib"} name-with-attributes
- "To be used in macro definitions.
- Handles optional docstrings and attribute maps for a name to be defined
- in a list of macro arguments. If the first macro argument is a string,
- it is added as a docstring to name and removed from the macro argument
- list. If afterwards the first macro argument is a map, its entries are
- added to the name's metadata map and the map is removed from the
- macro argument list. The return value is a vector containing the name
- with its extended metadata map and the list of unprocessed macro
- arguments."
- [name macro-args]
- (let [[docstring macro-args] (if (string? (first macro-args))
- [(first macro-args) (next macro-args)]
- [nil macro-args])
- [attr macro-args] (if (map? (first macro-args))
- [(first macro-args) (next macro-args)]
- [{} macro-args])
- attr (if docstring
- (assoc attr :doc docstring)
- attr)
- attr (if (meta name)
- (conj (meta name) attr)
- attr)]
- [(with-meta name attr) macro-args]))
-
(defmacro with-altered-var
"Binds var-name to the result of (f current-value args) for the dynamic
scope of body. Basically like swap! or alter, but for vars."
Please sign in to comment.
Something went wrong with that request. Please try again.