generic: Make dds-step-one fall back to dds-step-one-annotated.
This commit is contained in:
parent
db88987c13
commit
736f210c41
1 changed files with 10 additions and 1 deletions
11
generic.rkt
11
generic.rkt
|
@ -77,10 +77,18 @@
|
||||||
;;; A poor man's fallback for dds-step-one-annotated.
|
;;; A poor man's fallback for dds-step-one-annotated.
|
||||||
(define (fallback-dds-step-one-annotated dds s) (dds-step-one-annotated dds s))
|
(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.
|
;;; A discrete dynamical system.
|
||||||
(define-generics dds
|
(define-generics dds
|
||||||
;; Given a dds and a state, produce the next states of the 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)
|
(dds-step-one dds state)
|
||||||
;; Given a dds and a state, produce the next states paired with some
|
;; Given a dds and a state, produce the next states paired with some
|
||||||
;; annotation. Typical usage would include including the
|
;; annotation. Typical usage would include including the
|
||||||
|
@ -113,6 +121,7 @@
|
||||||
#:defined-predicate dds-implements?
|
#:defined-predicate dds-implements?
|
||||||
#:fallbacks
|
#:fallbacks
|
||||||
[(define dds-step fallback-dds-step)
|
[(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,
|
;; Run fallback-dds-build-state-graph-edges with an infinite range,
|
||||||
;; which will make it stop only when it has explored all the state
|
;; which will make it stop only when it has explored all the state
|
||||||
|
|
Loading…
Reference in a new issue