diff options
Diffstat (limited to 'models/nutrient.rkt')
| -rw-r--r-- | models/nutrient.rkt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/models/nutrient.rkt b/models/nutrient.rkt index dd8d677..1103aac 100644 --- a/models/nutrient.rkt +++ b/models/nutrient.rkt @@ -6,6 +6,8 @@ nutrient-canonical-name nutrient-french-name nutrient-formula + nutrient-value? + maybe-nutrient-value? nutrient-value-hash/c (contract-out [create-nutrient! (-> string? string? string? nutrient?)] [get-nutrients (-> (listof nutrient?))] @@ -33,7 +35,9 @@ #:property prop:custom-write (λ (v out _) (fprintf out "#<~a ~a>" (nutrient-id v) (nutrient-canonical-name v)))) -(define nutrient-value-hash/c (hash/c nutrient? (and/c real? (>=/c 0)) #:immutable #t)) +(define nutrient-value? (and/c real? (>=/c 0))) +(define maybe-nutrient-value? (or/c nutrient-value? #f)) +(define nutrient-value-hash/c (hash/c nutrient? nutrient-value? #:immutable #t)) ;; vector/c id, canonical name, french name, nutrient formula, value (ppm) (define residual-vector/c (vector/c exact-nonnegative-integer? string? string? string? real?)) |