Fork me on GitHub
#clojure-spec
<
2016-07-12
>
akiel15:07:17

Can someone please comment on http://dev.clojure.org/jira/browse/CLJ-1966? I would like to know if I possibly understand something wrong.

peeja16:07:48

I'm afraid I'm still failing to understand the difference between keys and keys*. I understand that only keys* works in a cat, but I don't understand why. Is this explained somewhere?

Alex Miller (Clojure team)16:07:59

@akiel rich hasn't looked at it yet

Alex Miller (Clojure team)16:07:52

@peeja keys is a spec for a map. keys* is a spec for a sequential list of alternating keys and vals

peeja16:07:26

So they both work in the same contexts, but match different things

Alex Miller (Clojure team)16:07:03

I'd say they work in different contexts to match the same thing :)

peeja16:07:37

By "context" I mean where they go in a spec

akiel16:07:08

@alexmiller it’s ok, as long as it’s on your list - thanks

peeja16:07:28

Yeah, I was misreading the guide. Thanks!

donaldball18:07:25

Revisiting the “spec strings as char seqs” idea from the weekend, I just threw this together:

donaldball18:07:57

Bad idea or simply misguided? 😛

Alex Miller (Clojure team)19:07:14

@donaldball: from a spec perspective I think it's much better to use an actual regex for matching

donaldball19:07:38

The things I’m finding attractive about expressing specs on char seqs are that the spec regex forms are often more readable, but more to the point: you get working generators for free

Alex Miller (Clojure team)19:07:19

There is a project for assembling readable regexes, can't remember the name

arohner19:07:35

that doesn’t use java.util.regex.Pattern though

Alex Miller (Clojure team)20:07:37

and also test.chuck has support for generating strings based on a regex

sparkofreason21:07:00

When writing regex specs, is there a way to get at the bindings "so far"? For instance, say I want to validate a datom [e a v], where a is keyword that represents a spec. I'd like to use that spec to validate v, and get "nice" output from explain that the failing spec is the one represented by a.

danburton21:07:52

oohh dependent specs, interesting

Alex Miller (Clojure team)21:07:38

@dave.dixon custom predicate? (s/and <datom-spec> #(s/valid? (:a %) (:v %)))

Alex Miller (Clojure team)21:07:55

doesn’t integrate into explain of course

bhauman21:07:30

Multi spec using second as the dispatch?

bhauman21:07:37

Then use a confirmed

danielcompton22:07:51

@alexmiller: what is the thinking behind it being under consideration? What are the downsides of allowing docstrings on specs?

sparkofreason22:07:12

@alexmiller: would be nice if there were a way to pass explain results out of custom predicates. Though perhaps not required in most cases.

Alex Miller (Clojure team)22:07:27

@dave.dixon: while it's tempting, I don't think Rich is inclined to support that for uniformity.