Re: case bug

2018-07-24 Thread Michael Gardner
As its docstring states, the `case` macro doesn't evaluate its test-constants. 
It only works on compile-time constants (e.g. literal strings/numbers), to 
allow O(1) matching. You want `condp` instead.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


case bug

2018-07-24 Thread 冯忠孝


(def rechargecardflowname "rechargecard")
(def rechargedirectflowname "rechargedirect")
(def procurementstockflowname "procurementstock")
(defn abolish-name [flowname]
  (str "abolish1" flowname)
  )
(defn report-rechargecard [billid]
  )

(defn consume-msg [msgname billid]
  (case msgname
rechargecardflowname (report-rechargecard billid)
rechargedirectflowname (report-rechargecard billid)
procurementstockflowname (report-rechargecard billid)
(abolish-name rechargecardflowname) (report-rechargecard billid)
(abolish-name rechargedirectflowname) (report-rechargecard billid)
(abolish-name procurementstockflowname) (report-rechargecard billid)
;(ym/f {:uri "/mq/report/msgname"} (str msgname " - 没有匹配到该消息名称") 9000)
))


CompilerException java.lang.IllegalArgumentException: Duplicate case test 
constant: rechargecardflowname, compiling:(D:/onedam/routes/mq.clj:34:3) 


[org.clojure/clojure "1.10.0-alpha6"]

win10 jdk1.8

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.