diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-23 00:11:36 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-23 00:11:36 +0200 |
commit | 2f648b55bbe5c6a5175dce53e610816b9547d498 (patch) | |
tree | aaf21ac2f9c20090be1552b90f58ea32b4531c8a /module/vcomponent/ical | |
parent | GET /search without query now works. (diff) | |
download | calp-2f648b55bbe5c6a5175dce53e610816b9547d498.tar.gz calp-2f648b55bbe5c6a5175dce53e610816b9547d498.tar.xz |
Micro optimization on string->symbol.
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent/ical/parse.scm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/module/vcomponent/ical/parse.scm b/module/vcomponent/ical/parse.scm index 2c01927b..96c18952 100644 --- a/module/vcomponent/ical/parse.scm +++ b/module/vcomponent/ical/parse.scm @@ -11,6 +11,14 @@ :use-module (vcomponent geo) ) +(define string->symbol + (let ((ht (make-hash-table 1000))) + (lambda (str) + (or (hash-ref ht str) + (let ((symb ((@ (guile) string->symbol) str))) + (hash-set! ht str symb) + symb))))) + ;; TODO rename to parse-vcomponent, or parse-ical (?). (define-public (parse-calendar port) (parse (map tokenize (read-file port)))) @@ -54,7 +62,7 @@ (data get-data) ; (key kv ... value) ) -;; (list <line>) → (list <tokens>) +;; <line> → <tokens> (define (tokenize line-obj) (define line (get-string line-obj)) (define colon-idx (string-index line #\:)) |