Fork me on GitHub

Can someone please comment on I would like to know if I possibly understand something wrong.


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


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


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


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


Yeah, I was misreading the guide. Thanks!


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


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


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


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


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.


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


Multi spec using second as the dispatch?


Then use a confirmed


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


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