utils: Move read-symbol-list from rs.

This commit is contained in:
Sergiu Ivanov 2020-03-02 23:00:46 +01:00
parent dbfa560081
commit 42b7dce359
3 changed files with 7 additions and 5 deletions

4
rs.rkt
View file

@ -86,10 +86,6 @@
;;; This section contains some useful primitives for Org-mode ;;; This section contains some useful primitives for Org-mode
;;; interoperability. ;;; interoperability.
;;; Reads a list of species from a string.
(define (read-symbol-list str)
(string->any (string-append "(" str ")")))
;;; Converts a triple of strings to a reaction. ;;; Converts a triple of strings to a reaction.
(define/match (str-triple->reaction lst) (define/match (str-triple->reaction lst)
[((list str-reactants str-inhibitors str-products)) [((list str-reactants str-inhibitors str-products))

View file

@ -60,7 +60,8 @@
(check-equal? (hash-ref m3 'a) '(and a b)) (check-equal? (hash-ref m3 'a) '(and a b))
(check-equal? (hash-ref m1 'b) '(or b (not a))) (check-equal? (hash-ref m1 'b) '(or b (not a)))
(check-equal? (hash-ref m2 'b) '(or b (not a))) (check-equal? (hash-ref m2 'b) '(or b (not a)))
(check-equal? (hash-ref m3 'b) '(or b (not a))))) (check-equal? (hash-ref m3 'b) '(or b (not a))))
(check-equal? (read-symbol-list "a b c") '(a b c)))
(test-case "Additional graph utilities" (test-case "Additional graph utilities"
(let* ([gr1 (directed-graph '((a b) (b c)))] (let* ([gr1 (directed-graph '((a b) (b c)))]

View file

@ -19,6 +19,7 @@
[unstringify-pairs (-> (listof (general-pair/c string? any/c)) [unstringify-pairs (-> (listof (general-pair/c string? any/c))
(listof (general-pair/c symbol? any/c)))] (listof (general-pair/c symbol? any/c)))]
[read-org-variable-mapping (-> string? variable-mapping?)] [read-org-variable-mapping (-> string? variable-mapping?)]
[read-symbol-list (-> string? (listof symbol?))]
[update-vertices/unweighted (-> graph? (-> any/c any/c) graph?)] [update-vertices/unweighted (-> graph? (-> any/c any/c) graph?)]
[update-graph (->* (graph?) [update-graph (->* (graph?)
(#:v-func (-> any/c any/c) (#:v-func (-> any/c any/c)
@ -219,6 +220,10 @@
;;; Typeset the graph via graphviz and display it. ;;; Typeset the graph via graphviz and display it.
(define-syntax-rule (dotit gr) (display (graphviz gr))) (define-syntax-rule (dotit gr) (display (graphviz gr)))
;;; Reads a list of symbols from a string.
(define (read-symbol-list str)
(string->any (string-append "(" str ")")))
;;; ========================== ;;; ==========================
;;; Additional graph utilities ;;; Additional graph utilities