All,

I've been playing with Clojure and found this 
website, http://www.lisperati.com/clojure-spels/casting.html.  Typed the 
code into Clojure 1.4.0 and got the issue below.  Here is the code in 
question.


(defmacro defspel [& rest] `(defmacro ~@rest))


(defspel game-action [command subj obj place & args]
  `(defspel ~command [subject# object#]
     `(spel-print (cond (and (= location '~'~place)
                             (= '~subject# '~'~subj)
                             (= '~object# '~'~obj)
                             (have? '~'~subj))
                        ~@'~args
                        :else '(i cannot ~'~command like that -)))))

(game-action weld chain bucket attic
   (cond (and (have? 'bucket) (def chain-welded true))
              '(the chain is now securely welded to the bucket -)
         :else '(you do not have a bucket -)))


When I do


(weld chain bucket)


instead of getting


(you do not have a chain -)


I get


(i cannot weld like that -)


>From what I'm reading (defspel game-action..., something isn't correct and 
the result is the :else instead of the if.  This was written using Clojure 
1.1, so if anyone has a solution about why this works in 1.1 and not 1.4 I 
would like to hear it.


TIA,
Joe 

-- 
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