Fork me on GitHub
#clojure-spec
<
2018-07-27
>
burbma13:07:12

Can anyone provide insight as to what’s going on here?

jumar13:07:39

(type (resolve 'string?))
;;=> clojure.lang.Var
user> (type string?)
;;=> clojure.core$string_QMARK___5132

guy13:07:04

Is resolve a spec function?

guy13:07:06

:thinking_face:

guy13:07:11

I’ve not seen it before

burbma13:07:55

resolve isn’t a spec function it’s in core. Suppose I started with "string?", how can I get to the clojure.core$string_QMARK_...? (resolve (symbol "string?)) won’t do it as we’ve seen.

guy13:07:49

really? ill check it out thanks!

guy13:07:11

ohh right got ya

guy13:07:01

if u want to see what it does, you can generally just try s/exercise and see what it produces

burbma13:07:42

s/exercise gives the same error for the (resolve (symbol "string?")) version of the spec.

guy13:07:24

Yeah i mean just for (s/exercise string?)

burbma13:07:49

Ah, no worries. Thanks for the pointer.

burbma14:07:43

Using (var-get (resolve (symbol "string?"))) does the trick.

noisesmith16:07:09

or deref, or the shorthand @

dspiteself15:07:43

Any idea when we will get this fix https://dev.clojure.org/jira/browse/CLJ-2003 in? We are still running a patched version.

Alex Miller (Clojure team)15:07:39

In queue to get screened

avi18:07:59

Last week at clojure/nyc I shared my experience, as a spec n00b, using spec to specify other people’s data structures … here’s the video if anyone’s interested: https://www.youtube.com/watch?v=eqfSifXaXnw

avi18:07:51

And for those in the Boston area I’ll be sharing this again at the Boston Clojure Group on 9 August: https://www.meetup.com/Boston-Clojure-Group/events/tjztcpyxlbmb/

fabrao18:07:32

Hello all, how

(defn ^:private menor? [n t]
  (<= (count n) t))
(s/def ::limite-tamanho menor?)

(s/valid? ::limite-tamanho <what is in here?>)

noisesmith18:07:41

I don't understand how your spec predicate could be a function of two args

noisesmith18:07:54

perhaps (partial menor? some-n) ?

fabrao18:07:20

well, it´s for dynamic size

noisesmith18:07:46

right, but how can you use that directly as a spec predicate? where would the other arg come from?

fabrao18:07:57

@noisesmith I´ll check many specs from vector, like fields in form -> [[:code "Error code" ::limite-tamanho 6] [:name "Error name" ::limite-tamanho 15]]

noisesmith18:07:15

maybe I'm missing some spec feature that would make this work, but I still don't understand how you'd make spec supply two args to your spec

noisesmith18:07:49

and as far as I know you can't use a neighbor or parent data in the check for a key

fabrao18:07:30

Well, I´m thinking use like this so, [:codigo "Código do vendedor" #(<= (count %) 6)]

noisesmith18:07:15

which is equivalent to what I proposed with partial above, right?

fabrao18:07:33

yes, thanks a lot