Fork me on GitHub

right, def doesn't exist in clojure.core, it's part of the base language


You could imagine a not-too-different clojure where special forms are namespaced and excludable


I'm curious what people think about the differences/benefits/relationships between: - Generative Property Based Testing - Pairwise Testing In particular is anyone combining the two... It seems to me that you could/should use generative tests to provide instance data within certain equivalence classes of values and then use pairwise testing to generate arguments as test pairs to apply to the function under test.


clojure.spec and music generation - has anyone tried it ? 😉


@borkdude: not I, but I've written some evolutionary music programs, and I think that'd be a really cool approach -- evolve organisms whose phenotype is a spec & generate music from the spec.


Carin Meier has already some genetic programming w/ spec.


@eggsyntax: thanks for the read!


Anyone using spec to parse and validate tabular data?


@alexmiller: Should I fill a ticket to have :conform-keys be turned into :conform-keys? (option in map-of), also :distinct-> :distinct?, there are possibly other bool options like these in spec, didn't check all of them


lopalghost: not yet - but I totally plan too


lopalghost: I think specs and their regexes etc are a natural fit for validating columns/rows of data


@rickmoynihan: I've been using it to read unfriendly excel spreadsheets, it's really helpful Was wondering what sort of approaches people might be taking

Alex Miller (Clojure team)15:08:37

@mpenet you can, not sure on the likelihood of that changing


lopalghost: I plan on doing the same thing - as it seems a natural fit... curious to hear about your experiences though


is clojure.spec/conform meant to be used in production code (and not only when developing/testing/instrumenting)? For spec/assert it is mentioned explicitly that is should be a no-op and disabled in production, same as with instrumenting and such. Does the same hold for spec/conform? Will the run-time impact be to high to use spec/conform generously everywhere?


my understanding is that conform is expected at the edges where you take input


it has the benefit of e.g. automatically classifying multiple options for you (s/or) via a map key


also, you don’t care about expensive there because a) you’re doing it once b) the alternative is potentially consuming random garbage and having it break somewhere down the road


thanks, I hadn't considered the "one time" aspect of using conform. I was thinking of using conform multiple times on the same value but that doesn't work as conform will most likely transform the value


For a couple of maps I want to specify, there are some derived values therein which I’d like to specify (and generate) correctly. For example {:a 1 :b 2 :a+b 3}. This is easy to express with (s/and (s/keys …) #(some-predicate)) but of course the generator essentially never passes the such-that filter


Has anyone found any good patterns for this situation?


donaldball: running the default generator through gen/fmap would make it easy enough to overwrite key like the one you showed


I don't think clojure.spec makes it easy to modify a generator though


I’ve kinda settled on having two specs, one which specifies the map with only independent values, and another which specifies the map including derived values


gen/fmap should help in that case too


Yea, it’s not hard to add on, I’m just wondering if anyone else has been writing specs for maps with internal value consistency requirements and, if so, if there’s a declarative approach to expressing them