utils: variable-mapping-stringify -> stringify-variable-mapping.
This commit is contained in:
parent
1eb48bc5e2
commit
7d52533f74
2 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@
|
||||||
(check-equal? (any->string 'a) "a")
|
(check-equal? (any->string 'a) "a")
|
||||||
(check-equal? (any->string '(a 1 (x y))) "(a 1 (x y))")
|
(check-equal? (any->string '(a 1 (x y))) "(a 1 (x y))")
|
||||||
(check-equal? (any->string "hello") "hello")
|
(check-equal? (any->string "hello") "hello")
|
||||||
(let ([mp (variable-mapping-stringify #hash((a . (and a b)) (b . (not b))))])
|
(let ([mp (stringify-variable-mapping #hash((a . (and a b)) (b . (not b))))])
|
||||||
(check-equal? (hash-ref mp 'a) "(and a b)")
|
(check-equal? (hash-ref mp 'a) "(and a b)")
|
||||||
(check-equal? (hash-ref mp 'b) "(not b)"))
|
(check-equal? (hash-ref mp 'b) "(not b)"))
|
||||||
(let ([mp (sgfy #hash((a . (and a b)) (b . (not b))))])
|
(let ([mp (sgfy #hash((a . (and a b)) (b . (not b))))])
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
(contract-out [eval-with (-> variable-mapping? any/c any)]
|
(contract-out [eval-with (-> variable-mapping? any/c any)]
|
||||||
[extract-symbols (-> any/c list?)]
|
[extract-symbols (-> any/c list?)]
|
||||||
[any->string (-> any/c string?)]
|
[any->string (-> any/c string?)]
|
||||||
[variable-mapping-stringify (-> variable-mapping? string-variable-mapping?)]
|
[stringify-variable-mapping (-> variable-mapping? string-variable-mapping?)]
|
||||||
[string->any (-> string? any/c)])
|
[string->any (-> string? any/c)])
|
||||||
;; Contracts
|
;; Contracts
|
||||||
(contract-out [variable-mapping? contract?]
|
(contract-out [variable-mapping? contract?]
|
||||||
|
@ -157,12 +157,12 @@
|
||||||
(define (string-variable-mapping? dict) (hash/c symbol? string?))
|
(define (string-variable-mapping? dict) (hash/c symbol? string?))
|
||||||
|
|
||||||
;;; Converts all the values of a variable mapping to string.
|
;;; Converts all the values of a variable mapping to string.
|
||||||
(define (variable-mapping-stringify ht)
|
(define (stringify-variable-mapping ht)
|
||||||
(make-hash (hash-map ht (λ (key val)
|
(make-hash (hash-map ht (λ (key val)
|
||||||
(cons key (any->string val))))))
|
(cons key (any->string val))))))
|
||||||
|
|
||||||
;;; A shortcut for variable-mapping-stingify.
|
;;; A shortcut for variable-mapping-stingify.
|
||||||
(define-syntax-rule (sgfy ht) (variable-mapping-stringify ht))
|
(define-syntax-rule (sgfy ht) (stringify-variable-mapping ht))
|
||||||
|
|
||||||
;;; Reads any value from string.
|
;;; Reads any value from string.
|
||||||
(define (string->any str)
|
(define (string->any str)
|
||||||
|
|
Loading…
Reference in a new issue