diff options
author | Arun Isaac | 2022-03-16 15:39:16 +0530 |
---|---|---|
committer | Arun Isaac | 2022-03-16 15:39:16 +0530 |
commit | b542b7e27bdb335bee812900d0c17a565a0d7dfb (patch) | |
tree | 6e6588a20cd76f2c6d578700c745f4e504bd0cf7 | |
parent | 3e535ada9e3d36d3626ae1dbcdef43aff6a6441d (diff) | |
download | tissue-b542b7e27bdb335bee812900d0c17a565a0d7dfb.tar.gz tissue-b542b7e27bdb335bee812900d0c17a565a0d7dfb.tar.lz tissue-b542b7e27bdb335bee812900d0c17a565a0d7dfb.zip |
tissue: Deduplicate keywords in hash table.
* tissue/issue.scm (hashtable-append!): Deduplicate after appending
new values.
-rw-r--r-- | tissue/issue.scm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tissue/issue.scm b/tissue/issue.scm index 7a5b6ff..59e7ee9 100644 --- a/tissue/issue.scm +++ b/tissue/issue.scm @@ -66,10 +66,14 @@ (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) '())) +HASHTABLE. Deduplicate the resulting list if necessary. If KEY is not +associated to any value in HASHTABLE, assume it is associated to the +empty list." + (hashtable-update! hashtable + key + (lambda (old-values) + (delete-duplicates (append old-values new-values))) + '())) (define (comma-split str) "Split string at commas, trim whitespace from both ends of the split |