Nevermind, I see now the infinite loop I've generated.. I'll delete the 
post thanks!

On Friday, October 5, 2018 at 1:49:12 PM UTC-5, Alexander Sedgwick wrote:
>
> I'm running into differences when having gen/fmap inside a s/with-gen vs 
> running it outside a s/with-gen. Am I missing something?
>
> ```clojure
> (ns scribble
>   (:require [clojure.spec.alpha :as s]
>             [clojure.spec.gen.alpha :as gen]))
>
> (s/def ::some-int
>   (s/or :zero zero?
>         :pos pos-int?))
>
> ;; works as expected
> (gen/sample (gen/fmap
>              (fn [x] (* x 2))
>              (s/gen ::some-int)))
>
> (s/def ::some-other-int
>   (s/with-gen
>     (s/or :zero zero?
>           :pos pos-int?)
>     #(gen/fmap
>       (fn [x] (* x 2))
>       (s/gen ::some-other-int))))
>
> ;; Stack overflow
> (gen/sample (s/gen ::some-other-int))
> ```
> Any help is appreciated.
>
> Thanks!
> Alex
>

-- 
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.

Reply via email to