#lang typed/racket ;;; dds/rs ;;; Definitions for working with reaction systems. (provide ;; Structures reaction ;; Type names Species ;; Functions enabled?) ;;; ================= ;;; Basic definitions ;;; ================= ;;; A species is a symbol. (define-type Species Symbol) ;;; A reaction is a triple of sets, giving the reactants, the ;;; inhibitors, and the products, respectively. (struct reaction ([reactants : (Setof Symbol)] [inhibitors : (Setof Symbol)] [products : (Setof Symbol)])) ;;; A reaction is enabled on a set if all of its reactants are in the ;;; set and none of its inhibitors are. (: enabled? (-> reaction (Setof Symbol) Boolean)) (define/match (enabled? r s) [((reaction r i p) s) (and (subset? r s) (set-empty? (set-intersect i s)))])