diff --git a/networks.rkt b/networks.rkt index 1f7524e..ed0c9f4 100644 --- a/networks.rkt +++ b/networks.rkt @@ -715,13 +715,12 @@ ;;; a listing the names of the variables of the domain and ending with ;;; the symbol 'f, which indicates the values of the function. (define (tabulate-state func domains #:headers [headers #t]) - (define (st-vals st) (hash-map st (λ (x y) y) #t)) - (define tab (for/list ([st (build-all-states domains)]) - (append (st-vals st) (list (func st))))) + (define tab (tabulate-state* `(,func) domains #:headers headers)) (cond [headers - (define vars (append (hash-map domains (λ (x y) x) #t) '(f))) - (cons vars tab)] + ;; Replace 'f1 in the headers by 'f. + (match tab [(cons hdrs vals) + (cons (append (drop-right hdrs 1) '(f)) vals)])] [else tab])) ;;; Like tabulate-state, but assumes the function is a Boolean