The name parameter of your function is shadowing clojure.core/name. On Mon, Oct 22, 2012 at 7:58 AM, JvJ <kfjwhee...@gmail.com> wrote: > I'm getting a REALLY weird error. I'm trying to check if a set of keywords > are all uppercase. > When binding a value to 'res' in the let statement, I traverse a list of > keywords. However, the calls to the name function on those > keywords give nil. The debug print statement clearly shows that the class > of k is a keyword, and yet its name is nil? > > I really don't get it. > > > ;; Program > (defn defrel-fn > "Adds a relation definition to the *relations* map." > [name keys] > (let [res (every? (fn [k] > (println "k: " (name k) ", " (class k)) ;; Added for > debugging > (= (name k) (.toUpperCase (name k)))) keys) > ;; keys need to be all in uppercase letters! > ;;_ (when-not res (throw (Exception. "Error. All keys must be > upper-case."))) > kns (apply hash-map (mapcat vector keys (range))) ;; represents a > map of keys to indices > ] > (swap! *relations* > assoc name {:fields kns > :unfields (vec keys) ;; A map of indices to keys is > best represented as a vector > }))) > > ;; Output from repl > => (worldrep.core/defrel-fn 'mother [:SELF :CHILD]) > k: nil , clojure.lang.Keyword > NullPointerException clojure.lang.Reflector.invokeNoArgInstanceMember > (Reflector.java:314) > > -- > 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
-- 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