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)))