diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-02-10 18:10:06 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-02-11 00:40:19 +0000 |
commit | 3e6da6b0f4abb6aa1f1274e183d039eeecebec86 (patch) | |
tree | d243fb012496c81cb618210b756306e7a69449b5 | |
parent | 5c6d444c2e73d6154a16ae9380662c2c75c6eafd (diff) | |
download | cantedraw-3e6da6b0f4abb6aa1f1274e183d039eeecebec86.tar.gz cantedraw-3e6da6b0f4abb6aa1f1274e183d039eeecebec86.tar.bz2 cantedraw-3e6da6b0f4abb6aa1f1274e183d039eeecebec86.zip |
Macro (alist-val) to access the actual value of a key in an alist
-rw-r--r-- | lib.macros.lisp | 4 | ||||
-rw-r--r-- | packages.lisp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib.macros.lisp b/lib.macros.lisp index f02e7a2..a866193 100644 --- a/lib.macros.lisp +++ b/lib.macros.lisp @@ -83,3 +83,7 @@ arguments `LAMBDA-LIST' with body `BODY'." sequentially" `(lambda (x) (->> x ,@forms))) + +(defmacro alist-val (key alist) + "Helper macro for getting the value of KEY in ALIST." + `(cdr (assoc ,key ,alist))) diff --git a/packages.lisp b/packages.lisp index 72d4dc5..977bf66 100644 --- a/packages.lisp +++ b/packages.lisp @@ -22,7 +22,7 @@ (:export :_ :--> :->> :-> :fn - :while + :while :alist-val :$)) (defpackage lib.functions |