I got bitten by this today as well... makes it hard to add a predicate that
destructures the map and compares its values.
On Friday, August 17, 2018 at 4:35:12 PM UTC-4, Alex Miller wrote:
>
> With s/and, conformed values flow through the predicates. This allows you
> to take advantage of structured values from early preds in later preds, so
> you're not having to re-understand the structure. (There are cases where
> having a non-flowing s/and would be useful and we've talked about adding
> that since way back, still TBD). For single values, there's not much
> difference, but it matters when you've got more structure, either from
> regex (really s/& then) or s/or, etc.
>
> With s/merge the idea is to combine 2 or more map specs and "merge" their
> specs, both during conform and gen. The mental picture I have is that the
> same data flows into all the merged preds in parallel (whereas s/and snakes
> them through in serial order). I don't have a good example at hand that
> illustrates where is critical, but certainly in cases where you combining
> s/keys with a collection view of map tuples with s/coll (sometimes called
> "hybrid maps"), this is essential.
>
>
>
> On Friday, August 17, 2018 at 2:36:23 PM UTC-5, Jenny Finkel wrote:
>>
>> Sorry, I meant to file a bug and even try to write a fix, but I was very
>> pregnant at the time and then I gave birth so it sort of fell by the
>> wayside. I'm interested in understanding why non-flowing behavior on
>> conform is expected/desired behavior. I've found that when clojure design
>> decisions go contrary to my intuitions, I usually learn a lot from
>> understanding the design motivation. Would you mind explaining?
>> Cheers,
>> Jenny
>> PS - I did try to google for an answer, and I found the thread where the
>> docstring for merge got updated to reflect this, but I couldn't find an
>> explanation.
>>
>> On Thu, Aug 16, 2018 at 7:00 PM, >
>> wrote:
>>
>>> Thank you for explaining!
>>>
>>> Just in case, I opened a bug here
>>> https://dev.clojure.org/jira/browse/CLJ-2388
>>>
>>> On Thursday, August 16, 2018 at 6:47:30 PM UTC-7, Alex Miller wrote:
The non-flowing behavior on conform is expected behavior.
Failure to roundtrip conform then unform is a bug (so I'd so the bug
here is in unform).
On a quick search, I don't believe this was filed, but I could have
missed it.
On Thursday, August 16, 2018 at 8:28:54 PM UTC-5, shlomi...@gmail.com
wrote:
>
> Achhh, just spent the last few hours fighting this unexpected behavior
> with s/merge, until I finally came to realize that this is what it was..
>
> I see this thread is quite old, did anyone open a bug for it as
> mentioned above?
>
> @Alex, you said this was the expected behavior, but then asked to open
> a bug because it does not round-trip.. I am slightly confused, does the
> problem lie in this "expected" behavior, or does it lie in s/unform? How
> would such a bug be closed?
>
> Thanks,
> Shlomi
>
> On Thursday, June 1, 2017 at 6:24:25 AM UTC-7, Alex Miller wrote:
>>
>> You can file a bug on the s/merge unform - anything that doesn't
>> roundtrip should be a bug.
>>
>> On the coll-of one, I thought that was just fixed in the latest
>> spec.alpha release (see https://dev.clojure.org/jira/browse/CLJ-2076)
>> - are you using latest there?
>>
> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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
>>> clo...@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 a topic in the
>>> Google Groups "Clojure" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/clojure/r8WO24rHsi0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> clo...@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.
To view this discussion on