I’m not 100% sure about any of this, but I think you’re tripping on how 
core.match handles symbols 
<https://github.com/clojure/core.match/wiki/Overview#local-scope-and-symbols>. 
So in (match dt dt2 true :else false), the code is *not* comparing the 
value in the dt Var to the value in the dt2 Var; it’s locally binding the 
name dt2 to the value in the dt Var. As for((dt-matcher dt) dt2), it 
returns false because core.match recognized that dt and dt2 were 
locally-scoped in the body of dt-matcher and as a result *actually* compared 
the DateTime objects, which do not match because you need to teach 
core.match how to use DateTimes 
<https://github.com/clojure/core.match/wiki/Pattern-Matching-Java-Objects>.

I hope that helps!
Josh

P.S. In future questions you pose, you should probably state the version of 
Clojure you’re using, as well as the versions of any libraries you’re using 
in your example.

On Monday, January 30, 2017 at 6:31:34 PM UTC-5, Joachim De Beule wrote:
>
> Does anybody understand what is going on here?
>
> (require '[clojure.core.matcher :refer [match]]
> (import '[org.joda.time DateTimeZone DateTime])
>
> (def dt (DateTime. 2013 02 12 4 30 0 (DateTimeZone/forOffsetHours -2)))
> (def dt2 (clj-time.coerce/from-string "2013-02-12T04:30:00.000-02:00"))
>
> (match dt dt2 true :else false)
> ;; => true
> ;; so far so good ..
>
> (defn dt-matcher [dt]
>   (fn [dt2]
>     (match dt dt2 true :else false)))
>
> ((dt-matcher dt) dt2)
> ;; => false
> ;; ???
>
> --
> Joachim
>

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

Reply via email to