diff options
author | Arun Isaac | 2021-04-16 18:01:25 +0530 |
---|---|---|
committer | Arun Isaac | 2021-04-16 18:01:25 +0530 |
commit | 72ca23f8385f1d425774e204dd7aa56b765c9a18 (patch) | |
tree | 5e38135b838d705911409a28e9be6b8843c940e8 | |
parent | 88f6ff9e7268475a5c6fb2222575ca1471e47b3a (diff) | |
download | ccwl-72ca23f8385f1d425774e204dd7aa56b765c9a18.tar.gz ccwl-72ca23f8385f1d425774e204dd7aa56b765c9a18.tar.lz ccwl-72ca23f8385f1d425774e204dd7aa56b765c9a18.zip |
Add plist-ref utility.
* ccwl/utils.scm: Import (srfi srfi-26).
(plist-ref): New function.
-rw-r--r-- | ccwl/utils.scm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ccwl/utils.scm b/ccwl/utils.scm index 90d6f0c..8f6692c 100644 --- a/ccwl/utils.scm +++ b/ccwl/utils.scm @@ -1,5 +1,6 @@ (define-module (ccwl utils) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-71) #:use-module (ice-9 match) #:export (group-arguments)) @@ -39,3 +40,10 @@ arity are listed in UNARY-KEYWORDS." (let ((positional-arguments keyword-arguments (break keyword? args))) (append positional-arguments (group-keyword-arguments keyword-arguments unary-keywords)))) +(define (plist-ref plist key) + "Return the value from the first entry in PLIST with the given KEY, +or #f if there is no such entry." + (match (find-tail (cut eq? key <>) plist) + ((_ value . _) value) + (#f #f))) + |