network: Create immutable hashes by default.

This commit is contained in:
Sergiu Ivanov 2020-02-22 23:22:43 +01:00
parent ac8e63c5f4
commit c2c87d0a7d

View file

@ -76,7 +76,7 @@
(define-syntax-rule (st mappings) (make-state mappings))
;;; A version of make-hash restricted to creating networks.
(define (make-network-from-functions funcs) (make-hash funcs))
(define (make-network-from-functions funcs) (make-immutable-hash funcs))
;;; =================================
@ -98,13 +98,13 @@
;;; Build a network from a network form.
(define (network-form->network bnf)
(make-hash
(make-immutable-hash
(hash-map bnf (λ (x form)
(cons x (update-function-form->update-function form))))))
;;; Build a network from a list of pairs of forms of update functions.
(define (make-network-from-forms forms)
(network-form->network (make-hash forms)))
(network-form->network (make-immutable-hash forms)))
;;; A shortcut for make-network-from-forms.
(define-syntax-rule (nn forms) (make-network-from-forms forms))