This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aws (1)
- # aws-lambda (16)
- # beginners (8)
- # boot (2)
- # cider (4)
- # cljsrn (9)
- # clojure (137)
- # clojure-italy (3)
- # clojure-russia (39)
- # clojure-spec (34)
- # clojure-uk (33)
- # clojurescript (44)
- # core-logic (11)
- # cursive (27)
- # data-science (16)
- # datomic (52)
- # duct (1)
- # emacs (1)
- # figwheel (2)
- # fulcro (90)
- # graphql (3)
- # hoplon (7)
- # lambdaisland (2)
- # leiningen (23)
- # lumo (1)
- # off-topic (1)
- # om (40)
- # onyx (44)
- # re-frame (116)
- # reagent (3)
- # shadow-cljs (87)
@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
@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:
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?
Would help to know more about the spec and understand why its generating huge collections
Sure. I’ll try to come up with a sample project replicating the issue I found this weekend
In the most general sense (considering multi arity and variadic), I think that is difficult
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
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)
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
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
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 - https://gist.github.com/danielneal/d82c142c9eab9f8caec0fa93b87ff7f3 - 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?
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 [email protected] 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
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?