s/spec is going to try to resolve that keyword during the definition. Does 
this do what you want?

(s/def :html/element
  (s/spec (s/cat
                 :tag keyword?
                 :attrs map?
                 :children (s/* (s/alt :element :html/element 
                                               :string string?)))))


On Wednesday, July 20, 2016 at 10:38:41 AM UTC-5, Johan Jonasson wrote:
>
> I might have stumbled upon a bug in clojure.spec, while trying to define a 
> spec. This doesn't compile:
>
> (s/def :html/element
>   (s/cat
>    :tag keyword?
>    :attrs map?
>    :children (s/* (s/alt :element (s/spec :html/element)
>                          :string  string?))))
>
> The exception says: "Unable to resolve spec: :html/element".
>
> Is it a bug, or is there another way to define this?
>

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