Re: Is it normal for exercise-fn to return examples that don't conform?

2017-04-02 Thread Didier

>
> Generated samples aren't unique.


Is there any reason why samples are not unique? Is this on purpose, or just 
an accidental consequence of the implementation?

Conform like this:
>
> (s/conform (:args (s/get-spec `wtv)) [0])
>
>
If I conform like that, it is not really conforming my function spec, just 
the argument spec. Like, I have the same issue if doing `(s/valid? `wtv 
(wtv 0))`. Basically, I want to understand the semantics of exercise-fn. 
Does it just call my function with input generated from the args spec, and 
does not care about return? I thought it was supposed to show you example 
of input which do make the spec valid.

Nevermind, the doc string answers this:

exercises the fn named by sym (a symbol) by applying it to
> n (default 10) generated samples of its args spec. When fspec is
> supplied its arg spec is used, and sym-or-f can be a fn.  Returns a
> sequence of tuples of [args ret].
>
>
On Sunday, 2 April 2017 03:55:19 UTC-7, Leon Grapenthin wrote:
>
> Generated samples aren't unique.
>
> Conform like this:
>
> (s/conform (:args (s/get-spec `wtv)) [0])
>
>
> On Thursday, March 30, 2017 at 2:55:35 AM UTC+2, Didier wrote:
>>
>> If you look at this example:
>>
>> (defn wtv [in] (if (= 0 in) 0 10))
>> (s/fdef wtv
>> :args (s/cat :in int?)
>> :ret (s/and int? #(not= 0 %)))
>>
>> (s/exercise-fn `wtv)
>> (s/conform `wtv (wtv 0))
>>
>> You'll see that exercise gives you most of the time the following sample:
>>
>> [(0) 0]
>>
>> But this fails to conform:
>>
>> => (s/conform `wtv (wtv 0))
>>
>> => :clojure.spec/invalid
>>
>>
>>  Also, why does exercise give repeated samples? Shouldn't they be unique?
>>
>> ([(0) 0] 
>>  [(-1) 10] 
>>  [(0) 0] 
>>  [(-1) 10] 
>>  [(-2) 10] 
>>  [(2) 10] 
>>  [(0) 0] 
>>  [(-1) 10] 
>>  [(-2) 10] 
>>  [(0) 0]) 
>>
>> Thanks
>>
>

-- 
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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Cognitect acquired by Microsoft

2017-04-02 Thread shlomivaknin
Man, what a good one! You ruined me for a moment there :D

On Saturday, April 1, 2017 at 1:00:16 PM UTC-7, Gregg Reynolds wrote:
>
> made ya look!
>

-- 
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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] - postagga, the natural language parser, has hit 0.2.6 with enhanced names detection !

2017-04-02 Thread Rafik NACCACHE
Hey guys,

I am pleased to announce that postagga has now enhanced dictionary-based
name detection for more accurate parsing !

postagga is still dependency-free and hapily runs on JVM and JS targets

please have a look on it here:
https://github.com/turbopape/postagga

Hope you find it useful !
-- 


[image: --]

Rafik Naccache
[image: https://]about.me/rafik_naccache


-- 
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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it normal for exercise-fn to return examples that don't conform?

2017-04-02 Thread Leon Grapenthin
Generated samples aren't unique.

Conform like this:

(s/conform (:args (s/get-spec `wtv)) [0])


On Thursday, March 30, 2017 at 2:55:35 AM UTC+2, Didier wrote:
>
> If you look at this example:
>
> (defn wtv [in] (if (= 0 in) 0 10))
> (s/fdef wtv
> :args (s/cat :in int?)
> :ret (s/and int? #(not= 0 %)))
>
> (s/exercise-fn `wtv)
> (s/conform `wtv (wtv 0))
>
> You'll see that exercise gives you most of the time the following sample:
>
> [(0) 0]
>
> But this fails to conform:
>
> => (s/conform `wtv (wtv 0))
>
> => :clojure.spec/invalid
>
>
>  Also, why does exercise give repeated samples? Shouldn't they be unique?
>
> ([(0) 0] 
>  [(-1) 10] 
>  [(0) 0] 
>  [(-1) 10] 
>  [(-2) 10] 
>  [(2) 10] 
>  [(0) 0] 
>  [(-1) 10] 
>  [(-2) 10] 
>  [(0) 0]) 
>
> Thanks
>

-- 
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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.