001  (ns nature.spec
002    "Common specs/api checks for core nature functions"
003    (:require [clojure.spec.alpha :as s]))
004  
005  (defn not-empty?
006    "A predicate version of not-empty, because it's a sensible feeature"
007    [coll]
008    (not (empty? coll)))
009  
010  (s/def ::genetic-sequence
011    (s/and coll?
012           not-empty?))
013  
014  (s/def ::guid string?)
015  
016  (s/def ::parents
017    (s/and coll?
018           not-empty?))
019  
020  (s/def ::age integer?)
021  
022  (s/def ::fitness-score number?)
023  
024  (s/def ::individual
025    (s/keys :req-un [::genetic-sequence
026                     ::guid
027                     ::parents
028                     ::age
029                     ::fitness-score]))
030  
031  (s/def ::population
032    (s/and #(s/coll-of (s/valid? ::individual %))
033           not-empty?))