From 6aab1b6bd1f9a5a18f656cddde0ea1e7e37642c1 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 1 Sep 2015 08:46:24 -0700 Subject: [PATCH] More docs on the let macros. --- docs/manual.scr | 4 ++++ docs/whenlet.lisp | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 docs/whenlet.lisp diff --git a/docs/manual.scr b/docs/manual.scr index 1b64f5f..a6ec979 100644 --- a/docs/manual.scr +++ b/docs/manual.scr @@ -214,6 +214,10 @@ based on the results of the bindings. This is useful for reducing common boilerplate where a let is used to perform some operations, and some code should be executed based on the results of those bindings. +For example, from @c(kmop/kmop.lisp): + +@code(@include[path="whenlet.lisp"]()) + @cl:with-package[name="kutils"]( @cl:doc(macro condlet) @cl:doc(macro condlet*) diff --git a/docs/whenlet.lisp b/docs/whenlet.lisp new file mode 100644 index 0000000..9a99ac4 --- /dev/null +++ b/docs/whenlet.lisp @@ -0,0 +1,13 @@ +* (macroexpand-1 + '(whenlet ((kwarg (slot-initarg slot)) + (value (dispatch-get-value + slot + (slot-table-value + slot ht snake-case)))) + (list kwarg value))) +(LET ((KWARG (SLOT-INITARG SLOT)) + (VALUE + (DISPATCH-GET-VALUE SLOT + (SLOT-TABLE-VALUE SLOT HT SNAKE-CASE)))) + (WHEN (AND KWARG VALUE) + (LIST KWARG VALUE)))