Hi Frédéric, On Thu, Jun 9, 2016 at 2:21 PM, Frederic Peschanski < frederic.peschanski.w...@gmail.com> wrote:
> ;; ============== > (:require [clojure.spec :as s])) > (s/def ::zero #{:zero}) > (s/def ::one #{:one}) > (s/def ::succ #{:succ}) > (s/def ::odd nil) > (s/def ::even (s/or :zero ::zero ; 0 is even > :even (s/tuple ::succ ::odd))) ; n+1 is even if > n is odd > (s/def ::odd (s/tuple ::succ ::even)) ; n+1 is odd if n is even > ;; ================== > > First question : is there a better way to define a set of mutually > recursive specs ? > No it's ok but you can remove (s/def ::odd nil). Christophe -- On Clojure http://clj-me.cgrand.net/ Clojure Programming http://clojurebook.com Training, Consulting & Contracting http://lambdanext.eu/ -- 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.