transition   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/core/petri-net.xtm

Implementation

;; transitions
(define transition
  (lambda (name pre post)
    (let* ((f (lambda ()
                (let ((tokens (map (lambda (p) (take-token p)) pre)))
                  (if (member #f tokens)
                      (for-each (lambda (p) (give-token p)) pre)
                      (for-each (lambda (p) (give-token p)) post))))))
      f)))


Back to Index