utils: Add read-symbol-list.
This commit is contained in:
parent
fe989ef8a7
commit
2af5656e71
3 changed files with 18 additions and 3 deletions
|
@ -214,6 +214,14 @@ Typeset the graph via graphviz and display it.
|
|||
|
||||
}
|
||||
|
||||
@defproc[(read-symbol-list (str String)) (Listof Symbol)]{
|
||||
|
||||
Reads a list of symbols from a string.
|
||||
|
||||
@examples[#:eval utils-evaluator
|
||||
(read-symbol-list "a b c")
|
||||
]}
|
||||
|
||||
@section{Additional graph utilities}
|
||||
|
||||
@section{Pretty printing}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
(provide
|
||||
;; Functions
|
||||
(contract-out [read-symbol-list (-> string? (listof symbol?))]
|
||||
[drop-first-last (-> string? string?)]
|
||||
(contract-out [drop-first-last (-> string? string?)]
|
||||
[list-sets->list-strings (-> (listof (set/c any/c)) (listof string?))]
|
||||
[pretty-print-set-sets (-> (set/c (set/c symbol?) #:kind 'dont-care) string?)]
|
||||
[update-vertices/unweighted (-> graph? (-> any/c any/c) graph?)]
|
||||
|
|
10
utils.rkt
10
utils.rkt
|
@ -9,7 +9,7 @@
|
|||
extract-symbols
|
||||
any->string stringify-variable-mapping string->any map-sexp
|
||||
read-org-sexp unorg unstringify-pairs
|
||||
read-org-variable-mapping unorgv
|
||||
read-org-variable-mapping unorgv read-symbol-list
|
||||
;; Syntax
|
||||
auto-hash-ref/explicit auto-hash-ref/:)
|
||||
|
||||
|
@ -254,3 +254,11 @@
|
|||
|
||||
(: dotit (-> Graph Void))
|
||||
(define dotit (compose display graphviz))
|
||||
|
||||
(: read-symbol-list (-> String (Listof Symbol)))
|
||||
(define (read-symbol-list str)
|
||||
(cast (string->any (string-append "(" str ")")) (Listof Symbol)))
|
||||
|
||||
(module+ test
|
||||
(test-case "read-symbol-list"
|
||||
(check-equal? (read-symbol-list "a b c") '(a b c))))
|
||||
|
|
Loading…
Reference in a new issue