Yes I have tried that. As soon as you use things like `or` or `alt` it 
becomes quite the tedious manual effort and you don't get away with s/keys 
anymore.

On Saturday, June 18, 2016 at 8:35:20 PM UTC+2, Josh Tilles wrote:
>
> Have you considered choosing labels that are themselves qualified 
> keywords with registered specs? That might feel like a workaround, but 
> I think it could get you most of what you’re looking for.
>
> For example:
>
> ```
> (s/def ::even-spec even?)
> ;= :user/even-spec
> (s/def ::odd-spec odd?)
> ;= :user/odd-spec
> (s/def ::label-even (s/spec ::even-spec))
> ;= :user/label-even
> (s/def ::label-odd (s/spec ::odd-spec))
> ;= :user/label-odd
> (s/conform (s/cat ::label-even ::even-spec, ::label-odd ::odd-spec) [2 3])
> ;= {:user/label-even 2, :user/label-odd 3}
> (s/conform (s/cat ::label-odd ::even-spec) [2])
> ;= {:user/label-odd 2}
> (s/valid? (s/keys) *1)
> ;= false
> (s/explain (s/keys) *2)
> ; In: [:user/label-odd] val: 2 fails spec: :user/label-odd at: 
> [:user/label-odd] predicate: odd?
> ;= nil
> ```
>
>
> On Saturday, June 18, 2016, Leon Grapenthin <grapent...@gmail.com 
> <javascript:>> wrote:
>
>> Assume I parse with conform. 
>>
>> Then I have functions that operate on the value returned by conform. I 
>> want to spec them.
>>
>> But I can't get a spec for the value returned by conform (so that I can 
>> spec said functions) automatically.
>>
>> Imagine `(s/conform-spec ::my-spec)` would return the spec of the result 
>> of calling (s/confom ::my-spec foo)
>>
>> So it would probably be valuable if a spec could give a spec of what its 
>> conform* returns`
>>
>> -- 
>> 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.
>>
>

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