generic: Make dds-step-one fall back to dds-step-one-annotated.

This commit is contained in:
Sergiu Ivanov 2020-03-02 12:11:09 +01:00
parent db88987c13
commit 736f210c41

View File

@ -77,10 +77,18 @@
;;; A poor man's fallback for dds-step-one-annotated.
(define (fallback-dds-step-one-annotated dds s) (dds-step-one-annotated dds s))
;;; Run dds-step-one-annotated, but then discard the annotations.
;;; This is a fallback for dds-step-one.
(define (fallback-dds-step-one dds state)
(for/set ([annotation-state (dds-step-one-annotated dds state)])
(match annotation-state
[(cons a s) s])))
;;; A discrete dynamical system.
(define-generics dds
;; Given a dds and a state, produce the next states of the dds.
;; This method has no fallback.
;; This method falls back to calling dds-step-one-annotated,
;; discarding the annotations.
(dds-step-one dds state)
;; Given a dds and a state, produce the next states paired with some
;; annotation. Typical usage would include including the
@ -113,6 +121,7 @@
#:defined-predicate dds-implements?
#:fallbacks
[(define dds-step fallback-dds-step)
(define dds-step-one fallback-dds-step-one)
;; Run fallback-dds-build-state-graph-edges with an infinite range,
;; which will make it stop only when it has explored all the state