Here it is adapted to use a deftype: https://gist.github.com/didibus/2ccd608ed9d226039f944b02a10f9ad5
I gather from your solution that "orchestra" is not needed to spec :ret > types? > It is not. The return spec will be used during st/check. If you want the return spec to be validated outside of st/check though, than you need Orchestra. I shall have to read up on deftype versus defrecord. > I recommend the clojure.org explanation: https://clojure.org/reference/datatypes#_deftype_and_defrecord In a nutshell, deftype is a blank Java class, defrecord is an extended PersistentHashMap. I am not sure why you need a VirtualTime, and what it will be doing, so I can't really comment on which solution is best. As James said, it appears you might be creating something that behaves the same way Double does? Double already has positive and negative infinity and NaN: (/ 0.0 0.0) ; NaN (* 99e9999 99e9999) ; Infinity (* 99e9999 -99e9999) ; -Infinity (< Double/NEGATIVE_INFINITY Double/POSITIVE_INFINITY) ; true (= Double/NEGATIVE_INFINITY Double/POSITIVE_INFINITY) ; false I'd suggest, if you need Double, use Double. If you need something close to Double, and you can build on top of it, simpler to go with the style of my first gist. If you can't build on top of double, deftype is probably what you want. On Monday, 10 April 2017 21:41:35 UTC-7, Brian Beckman wrote: > > Wow... that's a comprehensive solution, Didier :) Bravo! It's a good > lesson for s/fdef, which I haven't yet studied. I gather from your solution > that "orchestra" is not needed to spec :ret types? > > As to semantics, on the one hand, I can spec ::virtual-time as a light > overlay over Double and risk conflation of ordinary operators like < <= = > etc. On the other hand, I have several options for full protection. I shall > have to read up on deftype versus defrecord. > -- 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.