Re: instrumenting clojure.core

2016-06-14 Thread Leon Grapenthin
Thanks Alex, I was experimenting along similar lines. It might work since the lazy seq is not realized at this point and :f might not have been called. Otherwise the last clause would always hold true or never be called (due to earlier ArityException). It covers more of a test for map itself (h

Re: instrumenting clojure.core

2016-06-14 Thread Francesco Bellomi
I think map is a good example where the different arities have very different semantics, and maybe it would be practical to specify a separate spec for each arity. In the unified spec, both :args and :ret have to resort to (more or less explicit) unions in order to express the sum of the separa

Re: instrumenting clojure.core

2016-06-14 Thread Alex Miller
I was suggesting that you could do something like this (although I'm pretty sure this doesn't work right now): (s/fdef map :args (s/cat :f (s/fspec :args (s/+ ::s/any)) :colls (s/* seqable?)) :ret (s/or :seq seqable? :transducer ifn?) :fn #(if (zero? (count (-> % :args :colls

Re: instrumenting clojure.core

2016-06-13 Thread Alistair Roche
could be better because the user has to >>>>> infer how identity was called within map. >>>>> >>>>> So what we'd want is a codependent spec where we can say if you give N >>>>> sequences you have to give a fnN. Is this possible with the current ops? >>

Re: instrumenting clojure.core

2016-06-13 Thread Leon Grapenthin
ible with the current ops? >>>> >>> >>> Yes, with fspec - you could have a :fn spec on map that checked that the >>> arity of the fn passed to map matched the number of colls you were passed. >>>

Re: instrumenting clojure.core

2016-06-12 Thread Ryan Fowler
> On Jun 12, 2016, at 10:45 AM, Alex Miller wrote: > > Still much to be determined about this but I expect that specs for core will > be provided and maintained by us, because while there are a lot of obvious > specs in core, there are also a lot of far more subtle ones. I think this is the ri

Re: instrumenting clojure.core

2016-06-12 Thread Alistair Roche
owler wrote: >>>> >>>> Is there an effort to write specs for Clojure's core namespaces? Apologies >>>> if this has already been addressed. >>>> >>>> I've been tinkering with trivial (and probably wrong) fdefs on >>>> clojure.core/map and clojure.core/identity. It seems

Re: instrumenting clojure.core

2016-06-12 Thread Leon Grapenthin
;> clojure.core/map and clojure.core/identity. It seems that the spec >>> exception messages are way better than what we have now. >>> >>> Code is here: >>> https://gist.github.com/ryfow/69a64e966d48258dfa9dcb5aa74005eb >>> <https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fryfo

Re: instrumenting clojure.core

2016-06-12 Thread Alex Miller
eems that the spec >> exception messages are way better than what we have now. >> >> Code is here: >> https://gist.github.com/ryfow/69a64e966d48258dfa9dcb5aa74005eb >> <https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fryfow%2F69a64e966d48258dfa9dcb5aa7

Re: instrumenting clojure.core

2016-06-12 Thread Leon Grapenthin
.github.com/ryfow/69a64e966d48258dfa9dcb5aa74005eb > > > ===== > Before instrumenting clojure.core/map > = > Form: (into [] (map nil [1 2 3] [1 2 3])) > Exception

instrumenting clojure.core

2016-06-12 Thread Alex Miller
Yeah, I've been working on parts of this and there will be more to say in the future. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - pleas

instrumenting clojure.core

2016-06-12 Thread Ryan Fowler
e have now. Code is here: https://gist.github.com/ryfow/69a64e966d48258dfa9dcb5aa74005eb ===== Before instrumenting clojure.core/map = Form: (into [] (map nil [1 2 3] [1 2 3]))