diff options
author | Arun Isaac | 2021-09-23 00:46:21 +0530 |
---|---|---|
committer | Arun Isaac | 2021-09-23 14:16:47 +0530 |
commit | f7ed0ce8a3c9f23c31c71b47f344c9b90cfc30fb (patch) | |
tree | 6abd9c8055bd81651eacd737bbd6bd1930e474c3 /gnbug | |
parent | ae4a4bb349ccc2d609f59b02d530adf0051b15ca (diff) | |
download | gn-gemtext-f7ed0ce8a3c9f23c31c71b47f344c9b90cfc30fb.tar.gz |
gnbug: Abstract out hashtable-append!.
* gnbug (hashtable-append!): New function.
(file-details): Use hashtable-append!.
Diffstat (limited to 'gnbug')
-rwxr-xr-x | gnbug | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -83,6 +83,13 @@ even if it exits non-locally. Return the value returned by PROC." (> (issue-created-date issue1) (issue-created-date issue2))))) +(define (hashtable-append! hashtable key new-values) + "Append NEW-VALUES to the list of values KEY is associated to in +HASHTABLE. If KEY is not associated to any value in HASHTABLE, assume +it is associated to the empty list." + (hashtable-update! + hashtable key (cut append <> new-values) '())) + (define (file-details file) "Return a hashtable of details extracted from gemini FILE." (let ((result (make-eq-hashtable))) @@ -93,14 +100,11 @@ even if it exits non-locally. Return the value returned by PROC." ;; Lists with the assigned: prefix ;; specify assignees. ((string-prefix? "* assigned:" line) - (hashtable-update! result 'assigned - (lambda (previous) - (append (map (cut string-trim-both <>) - (string-split - (substring line (string-length "* assigned:")) - #\,)) - previous)) - '())) + (hashtable-append! result 'assigned + (map (cut string-trim-both <>) + (string-split + (substring line (string-length "* assigned:")) + #\,)))))) ;; The first level one heading is the ;; title. ((string-prefix? "# " line) |