On Tue, Jan 3, 2012 at 4:16 AM, JuanManuel Gimeno Illa
<jmgim...@gmail.com>wrote:

> I'm trying to use :or patterns with records but I'm getting an error and
> I'm not sure if I have found a bug (or a  not-implemented-yet) or if its
> the intended behavior (and there are good reasons for it).
>
> Without :or patterns I can do:
>
> (let [x {:a 1 :b 2}]
>     (clojure.core.match/match [x]
>          [{:a 1 :b b}] b
>          [{:a 2 :b b}] b))
> ;=> 2
>
> I can group 1 and 2 values with :or and do:
>
> (let [x {:a 1 :b 2}]
>     (clojure.core.match/match [x]
>          [{:a (:or 1 2) :b b}] b))
> ;=> 2
>
> But I'd want to do:
>
> (let [x {:a 1 :b 2}]
>     (clojure.core.match/match [x]
>          [(:or {:a 1 :b b} {:a 2 :b b})] b))
>
> which throws and exception and prints: Unable to resolve symbol: b in this
> context
>
> Is this the way it's supposed to be?
>
> Thanks,
>
> Juan Manuel
>

This works find in master. Which version of core.match are you using?

David

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