Re: clojure.spec, conform and returned value

2016-10-11 Thread Alex Miller
On Tuesday, October 11, 2016 at 1:30:18 PM UTC-5, plamen.use...@gmail.com wrote: > > Hello, > > I have a problem which is probably not in the spirit of clojure.spec as > being a library for "only" checking/generating valid values, but of > substantial practical value for my use case: > > Let s

Re: clojure.spec, conform and returned value

2016-10-11 Thread plamen . usenet
Amazing! Lot of thanks Josh! This solves everything. It is even written in the API doc, but I missed the important piece of "(possibly converted) value"... With best regards Plamen On Tuesday, October 11, 2016 at 8:49:16 PM UTC+2, Josh Tilles wrote: > > I think you’re looking for conformer >

Re: clojure.spec, conform and returned value

2016-10-11 Thread Josh Tilles
I think you’re looking for conformer ; the spec it produces will pass along the converted value instead of the original input. It could be used like: (defn str->double [s] (try (Double/valueOf s)

clojure.spec, conform and returned value

2016-10-11 Thread plamen . usenet
Hello, I have a problem which is probably not in the spirit of clojure.spec as being a library for "only" checking/generating valid values, but of substantial practical value for my use case: Let say I have a function for checking if a double precision number is parsable from a string (where p