networks: Rewrite tabulate-state to use tabulate-state*.
This commit is contained in:
parent
42ffc37eeb
commit
a34b08e477
1 changed files with 4 additions and 5 deletions
|
@ -715,13 +715,12 @@
|
||||||
;;; a listing the names of the variables of the domain and ending with
|
;;; a listing the names of the variables of the domain and ending with
|
||||||
;;; the symbol 'f, which indicates the values of the function.
|
;;; the symbol 'f, which indicates the values of the function.
|
||||||
(define (tabulate-state func domains #:headers [headers #t])
|
(define (tabulate-state func domains #:headers [headers #t])
|
||||||
(define (st-vals st) (hash-map st (λ (x y) y) #t))
|
(define tab (tabulate-state* `(,func) domains #:headers headers))
|
||||||
(define tab (for/list ([st (build-all-states domains)])
|
|
||||||
(append (st-vals st) (list (func st)))))
|
|
||||||
(cond
|
(cond
|
||||||
[headers
|
[headers
|
||||||
(define vars (append (hash-map domains (λ (x y) x) #t) '(f)))
|
;; Replace 'f1 in the headers by 'f.
|
||||||
(cons vars tab)]
|
(match tab [(cons hdrs vals)
|
||||||
|
(cons (append (drop-right hdrs 1) '(f)) vals)])]
|
||||||
[else tab]))
|
[else tab]))
|
||||||
|
|
||||||
;;; Like tabulate-state, but assumes the function is a Boolean
|
;;; Like tabulate-state, but assumes the function is a Boolean
|
||||||
|
|
Loading…
Reference in a new issue