Put boolean at the end of function names.

This commit is contained in:
Sergiu Ivanov 2022-09-21 00:20:20 +02:00
parent 2577d06dbc
commit 4c3415f0ac
2 changed files with 15 additions and 15 deletions

View file

@ -35,8 +35,8 @@
Modality Mode dynamics% Dynamics% make-syn make-asyn Modality Mode dynamics% Dynamics% make-syn make-asyn
make-asyn-dynamics make-syn-dynamics pretty-print-state make-asyn-dynamics make-syn-dynamics pretty-print-state
pretty-print-boolean-state pretty-print-state-graph-with pretty-print-state/boolean pretty-print-state-graph-with
pretty-print-state-graph ppsg pretty-print-boolean-state-graph ppsgb pretty-print-state-graph ppsg pretty-print-state-graph/boolean ppsgb
) )
(define-type (State a) (VariableMapping a)) (define-type (State a) (VariableMapping a))
@ -667,14 +667,14 @@
(check-equal? (pretty-print-state (hash 'a #f 'b 3 'c 4)) (check-equal? (pretty-print-state (hash 'a #f 'b 3 'c 4))
"a:#f b:3 c:4"))) "a:#f b:3 c:4")))
(: pretty-print-boolean-state (All (a) (-> (State a) String))) (: pretty-print-state/boolean (All (a) (-> (State a) String)))
(define (pretty-print-boolean-state s) (define (pretty-print-state/boolean s)
(string-join (hash-map s (λ (key val) (format "~a:~a" key (any->01 val))) #t))) (string-join (hash-map s (λ (key val) (format "~a:~a" key (any->01 val))) #t)))
(module+ test (module+ test
(test-case "pretty-print-boolean-state" (test-case "pretty-print-state/boolean"
(check-equal? (check-equal?
(pretty-print-boolean-state (hash 'a #f 'b #t 'c #t)) (pretty-print-state/boolean (hash 'a #f 'b #t 'c #t))
"a:0 b:1 c:1"))) "a:0 b:1 c:1")))
(: pretty-print-state-graph-with (-> Graph (-> Any Any) Graph)) (: pretty-print-state-graph-with (-> Graph (-> Any Any) Graph))
@ -691,13 +691,13 @@
(define ppsg pretty-print-state-graph) (define ppsg pretty-print-state-graph)
(: pretty-print-boolean-state-graph (-> Graph Graph)) (: pretty-print-state-graph/boolean (-> Graph Graph))
(define (pretty-print-boolean-state-graph gr) (define (pretty-print-state-graph/boolean gr)
(define (pprinter/any [x : Any]) (define (pprinter/any [x : Any])
(pretty-print-boolean-state (assert-type x (State Any)))) (pretty-print-state/boolean (assert-type x (State Any))))
(pretty-print-state-graph-with gr pprinter/any)) (pretty-print-state-graph-with gr pprinter/any))
(define ppsgb pretty-print-boolean-state-graph) (define ppsgb pretty-print-state-graph/boolean)
) )
(require 'typed) (require 'typed)

View file

@ -476,12 +476,12 @@ Pretty-prints a state of a network.
} }
@defproc[(pretty-print-boolean-state [s (State a)]) String]{ @defproc[(pretty-print-state/boolean [s (State a)]) String]{
Pretty-prints a state of a network, replacing all @racket[#f] values with 0 and Pretty-prints a state of a network, replacing all @racket[#f] values with 0 and
all other values with 1. all other values with 1.
@ex[(pretty-print-boolean-state (hash 'a #f 'b 3 'c '() 'd #t))] @ex[(pretty-print-state/boolean (hash 'a #f 'b 3 'c '() 'd #t))]
} }
@ -506,15 +506,15 @@ A shortcut for @racket[pretty-print-state-graph].
} }
@defproc[(pretty-print-boolean-state-graph [gr Graph]) Graph]{ @defproc[(pretty-print-state-graph/boolean [gr Graph]) Graph]{
Calls @racket[pretty-print-state-graph-with] with @racket[pretty-print-boolean-state]. Calls @racket[pretty-print-state-graph-with] with @racket[pretty-print-state/boolean].
} }
@defproc[(ppsgb [gr Graph]) Graph]{ @defproc[(ppsgb [gr Graph]) Graph]{
A shortcut for @racket[pretty-print-boolean-state-graph]. A shortcut for @racket[pretty-print-state-graph/boolean].
} }