summaryrefslogtreecommitdiff
path: root/email/utils.scm
diff options
context:
space:
mode:
Diffstat (limited to 'email/utils.scm')
-rw-r--r--email/utils.scm19
1 files changed, 11 insertions, 8 deletions
diff --git a/email/utils.scm b/email/utils.scm
index 536dc52..70153be 100644
--- a/email/utils.scm
+++ b/email/utils.scm
@@ -26,13 +26,14 @@
#:use-module ((rnrs io ports)
#:select (call-with-bytevector-output-port))
#:use-module (rnrs io simple)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (get-line-with-delimiter
read-objects
read-while
read-bytes-till
acons*
- alist-delete*))
+ alist-combine))
(define (read-objects read-proc port)
"Read all objects using READ-PROC from PORT and return them as a
@@ -101,13 +102,15 @@ delimiting linefeed character."
(acons key value (apply acons* rest)))
((alist) alist)))
-(define (alist-delete* keys alist)
- "Return a list containing all elements of ALIST whose keys are not a
-member of KEYS."
- (filter (match-lambda
- ((key . _)
- (not (member key keys))))
- alist))
+(define (alist-combine alist1 alist2)
+ "Combine two association lists ALIST1 and ALIST2 into a single
+association list. Key-value pairs in ALIST2 are more significant and
+override those in ALIST1."
+ (append alist2
+ (remove (match-lambda
+ ((key . _)
+ (assoc key alist2)))
+ alist1)))
(define (cg-string-ci pat accum)
(syntax-case pat ()