Fork me on GitHub

@b.j.vanderes FWIW, my understanding is that conformers are not intended to be used to change the shape of the data, so you may run into problems here. Perhaps it’d be easiest to just conform as normal, then write a transformation function that uses the conformed values and converts them

Brendan van der Es01:10:58

@bbrinck @hiredman Yea, this is all probably too counter to intention to be usable (performance might also be an issue). But just for fun this is what I came up with as far as defining functions that process the conformed arguments:

Brendan van der Es02:10:55

Can combine with above to mitigate an outer layer of branching in the function.


I get OutOfMemoryError when calling instrumented function with wrong number of arguments where one of the argument is a huge collection. I know it’s considered user mistake but it’s a kind of mistake that is quite hard to figure out the cause. Should clojure prevent that, or break circuit or something?

Alex Miller (Clojure team)12:10:33

Would help to know more about the spec and understand why its generating huge collections

Alex Miller (Clojure team)12:10:49

There are some known issues in this area


Sure. I’ll try to come up with a sample project replicating the issue I found this weekend


What is the best way of getting the specs of arguments to an fdef'd function?


I've got an approach here


but it uses eval and is probably all wrong 🙃

Alex Miller (Clojure team)12:10:18

Yeah, don’t do that :)

Alex Miller (Clojure team)12:10:55

Just (-> sym s/get-spec :args)

Alex Miller (Clojure team)12:10:47

Or do you want the spec of each argument separately?

Alex Miller (Clojure team)12:10:01

In the most general sense (considering multi arity and variadic), I think that is difficult


yeah - the spec of each argument separately


thanks for the get-spec tip 🙂


just doing a very rough and ready thing to see if I can go from a value to the (specced) functions that you can invoke that take that value as an arg


like intellisense, but stupid


stupidisense, if you will

Alex Miller (Clojure team)14:10:30

this is kind of what’s happening inside of spec regex validation checking, but it’s really happening left to right and every possibility is being evaluated and narrowed based on the prior matches (of which there may be multiple)

Alex Miller (Clojure team)14:10:11

so a priori before starting the parse there is not necessarily a single spec but really a set of specs that may apply at each point

Alex Miller (Clojure team)14:10:58

that said, there is the very common case that the args spec is a single non-variadic arity and each arg matches up 1-for-1 with an s/cat args spec

Alex Miller (Clojure team)14:10:22

in which case, you can just pull the s/cat spec apart to match it up


mm yes I follow you. Technically the args spec for fns could be any regex (or anything) but in practice there will be a common case like you described


this is what I've got so far - - I'd like to see if I can get it completing in emacs to see if it 'feels' useful. Dumb but proof of concept, like when IDEO demonstrated the talking kitchen with people hidden behind the fridge saying stuff and responding to voice commands.


Sometimes I get errors such as: `java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.test.check.generators/choose, compiling:(generators.cljc:499:3) Exception in thread "main" java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.test.check.generators/choose, compiling:(generators.cljc:499:3)` It happens with different test.check unbound fns, it is not the same every time and a rebuild usually resolves the error. The file that is beeing compiled is a quite basic cljc file with some specs in it. Does anyone have any advice to point me in the right direction?

Alex Miller (Clojure team)21:10:55

Any chance this is happening during check?

Alex Miller (Clojure team)21:10:20

There is a dynamic load race that can happen with loading the test check generator namespace that we have a ticket on. I don’t remember how@it presents, but it was weird looking


@U064X3EF3 Sorry for the late reply. The stack trace only show line 1 for my files i.e. in the ns loading. The file do include a stest/check test but from the stack trace I do not seem to hit that. It blow up on the first line. I'll try and find the ticket you mentioned and see if that holds any clues


in an s/fdef :fn spec for a tree function of mine, it seems like I need to get access to the un-conformed argument (a tree) to the function so I can pass it to some other tree functions to build up my validation. is there a way to gain access to the un-conformed args or perhaps to un-conform the conformed args?


is the right word for “un-conform” “unform”?