From 7b09445140983623173203c4594bb54dcd55fe1e Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Thu, 13 Nov 2025 16:15:05 +0100 Subject: Add nutrient-value-pair/c contract. --- models/nutrient.rkt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'models') diff --git a/models/nutrient.rkt b/models/nutrient.rkt index 10e274e..944583e 100644 --- a/models/nutrient.rkt +++ b/models/nutrient.rkt @@ -1,12 +1,14 @@ #lang racket (provide - ;; Struct definitions + ;; Model struct nutrient nutrient? nutrient-id nutrient-name nutrient-formula - ;; SQL CRUD + ;; Contracts + nutrient-value-pair/c (contract-out + ;; SQL CRUD [create-nutrient! (-> string? string? nutrient?)] [get-nutrients (-> (listof nutrient?))] [get-nutrient (->* () @@ -33,6 +35,9 @@ (nutrient-id v) (nutrient-name v)))) +(define nutrient-value-pair/c + (cons/c nutrient? (and/c real? (>=/c 0)))) + ;; CREATE -- cgit v1.2.3