Fork me on GitHub
#clojure-spec
<
2016-10-15
>
samedhi20:10:57

(above) Having a bit of confusion about when specs can be used in :ret and when they can be used in spec/and.

gfredericks20:10:52

@samedhi the :fn on line 24 is not supposed to be a spec

gfredericks20:10:03

it's supposed to be a function that compares the args and the return value

gfredericks20:10:11

and you can leave it off if you don't have anything obvious to check

gfredericks20:10:45

that might not be your problem, I'm just guessing

samedhi20:10:47

Oh, you mean within it

samedhi21:10:48

Yes, it does state it takes a spec, but it should “contain predicates"

samedhi21:10:54

innnteresting

gfredericks21:10:00

I would wager "A spec of the relationship..." is a typo, unless things have changed recently

gfredericks21:10:08

I'll check on that actually

gfredericks21:10:14

what's the latest clojure version

samedhi21:10:24

1.9.0-alpha13 I think?

gfredericks21:10:07

looks like there's 13

samedhi21:10:18

Yeah, I just checked and saw that. 🙂

samedhi21:10:31

> Note that :fn specs require the presence of :args and :ret specs to conform values, and so :fn specs will be ignored if :args or :ret are missing.

samedhi21:10:18

Ugh, that line alone would have saved me hooours. I don’t know what you can do for people who don’t read the api docs (sorry), but figuring this out on my own just hurt.

samedhi21:10:08

Maybe a warning if you include a :fn but not :args and :ret

gfredericks21:10:01

looks like the s/and thing does work, and I don't know why

gfredericks21:10:04

so TIL I guess

samedhi21:10:36

@gfredericks Sounds good, yeah, no idea. Thanks for you help. TIL I should always read the docs right after going through the getting started section 😬