This fix has some bugs - you let finder but never use it. Adjusted
below:

(defmacro unique?
  [name value msg]
  (let [finder (symbol (str "by-" (clojure.core/name name)))])
  `(let [value# ~value]
     (when-not (str/blank? value#)
       (when-let [existing# (~finder value#)]
         (duplicate existing# ~msg value#)))))

On Oct 5, 6:52 am, "Meikel Brandmeyer (kotarak)" <m...@kotka.de>
wrote:
> Hi,
>
> you have the conversion to the "by-name" function in the wrong level of
> quoting in the macro.
>
> (defmacro unique?
>   [name value msg]
>   `(let [value#  ~value]
>      (when-not (str/blank? value#)
>        (let [finder# ~(symbol (str "by-" (clojure.core/name name)))]
>          (when-let [existing# (existing value#)]
>            (duplicate existing# ~msg value#))))))
>
> Sincerely
> Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to