rs,union-products: Return an empty set when no reaction names are given.
This commit is contained in:
parent
6427af17c8
commit
868988c966
1 changed files with 7 additions and 4 deletions
11
rs.rkt
11
rs.rkt
|
@ -51,15 +51,18 @@
|
|||
name))
|
||||
|
||||
;;; Returns the union of the product sets of the given reactions in a
|
||||
;;; reaction system.
|
||||
;;; reaction system. If no reactions are supplied, returns the empty
|
||||
;;; set.
|
||||
;;;
|
||||
;;; This function can be seen as producing the result of the
|
||||
;;; application of the given reactions to a set. Clearly, it does not
|
||||
;;; check whether the reactions are actually enabled.
|
||||
(define (union-products rs as)
|
||||
(apply set-union
|
||||
(for/list ([a as])
|
||||
(reaction-products (hash-ref rs a)))))
|
||||
(if (empty? as)
|
||||
(set)
|
||||
(apply set-union
|
||||
(for/list ([a as])
|
||||
(reaction-products (hash-ref rs a))))))
|
||||
|
||||
;;; Applies a reaction system to a set.
|
||||
(define (apply-rs rs s)
|
||||
|
|
Loading…
Reference in a new issue