diff options
-rw-r--r-- | shroud/utils.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shroud/utils.scm b/shroud/utils.scm index 20545e1..59dbbc2 100644 --- a/shroud/utils.scm +++ b/shroud/utils.scm @@ -24,6 +24,7 @@ vhash-replace vhash-values alist-compact + alist-pick gpg-binary call-with-encrypted-output-file call-with-decrypted-input-file)) @@ -58,6 +59,16 @@ such key." (loop tail (cons key keys) (alist-cons key value result))))))) +(define (alist-pick alist key) + "Return a list of the values in ALIST that are associated with KEY." + (fold-right (lambda (key+value result) + (match key+value + ((k . value) + (if (equal? key k) + (cons value result) + result)))) + '() alist)) + (define gpg-binary (make-parameter "gpg")) (define (call-with-pipe* program+args mode proc) |