RE: clojure.spec - Using :pre conditions (or not)?

2017-06-08 Thread David Goldfarb
r code body than in a precondition. On Wednesday, June 7, 2017 at 8:12:22 AM UTC-5, David Goldfarb wrote: One big downside of using s/assert in a precondition: It does not work with (s/nilable ...) specs, since s/assert returns valid values. I fell into this trap for a moment of head-scratching ju

Re: clojure.spec - Using :pre conditions (or not)?

2017-06-07 Thread David Goldfarb
One big downside of using s/assert in a precondition: It does not work with (s/nilable ...) specs, since s/assert returns valid values. I fell into this trap for a moment of head-scratching just now. On Wednesday, September 14, 2016 at 4:59:09 PM UTC+3, Alex Miller wrote: > > Another option

Best style for clojure.spec and namespaced keywords?

2016-10-10 Thread David Goldfarb
I'm starting to dive into clojure.spec, which is a strong motivation for me to finally appreciate and use namespaced keywords -- an aspect of Clojure that I've ignored until now. I don't have a good sense of style re how to namespace keywords, especially in standalone projects. I'm inclined to

Re: In clojure.spec, how to declare all valid keys in a map

2016-09-21 Thread David Goldfarb
ser/BAD 0] val: :boot.user/BAD fails spec: :boot.user/my-map >> at: [0] predicate: #{:boot.user/a :boot.user/b} >> >> Seems better >> >> On Tuesday, September 20, 2016 at 5:38:10 AM UTC-7, David Goldfarb wrote: >>> >>> In clojure.spec, how ca

In clojure.spec, how to declare all valid keys in a map

2016-09-20 Thread David Goldfarb
In clojure.spec, how can I declare a map that accepts only certain keys? *{::a 1 ::b 2 ::BAD 3}* does conform to *(s/keys :req :req [::a ::b])*, but I want a spec that will be bothered by ::BAD or any other undeclared key. My use case: I am introducing spec to some legacy code, and I want to

Re: [ANN] lein-pedantic is now deprecated

2013-10-31 Thread David Goldfarb
Count me as another +1 for both these features. On Thursday, May 30, 2013 4:25:22 AM UTC+3, Nelson Morris wrote: Good news everybody! As of leiningen 2.2.0 using `lein deps :tree` will perform version checks and version range detection. Therefore, I have deprecated lein-pedantic. I

Re: Stack overflow deep in repl printer

2013-07-12 Thread David Goldfarb
Yes, I agree with you: better to bind outside the whole repl loop. I misspoke when I said around the printing. That said, I think it might still be reasonable to put much tighter bounds on the cotents inside the printing of # ... . David On Thursday, July 11, 2013 3:09:07 PM UTC+3, Meikel

Stack overflow deep in repl printer

2013-07-11 Thread David Goldfarb
The following pathological case triggers a confusing stack overflow error. *$ lein repl* *...* *user= (def x (atom nil))* *#'user/x* *user= (reset! x x)* * * *StackOverflowError java.util.regex.Pattern$Curly.match (Pattern.java:4125)* * * *;;; Of course, I can avoid the problem:* *user= (set!