More docs on the let macros.

This commit is contained in:
Kyle 2015-09-01 08:46:24 -07:00
parent 08f5ff5d0d
commit 6aab1b6bd1
2 changed files with 17 additions and 0 deletions

View File

@ -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 common boilerplate where a let is used to perform some operations, and
some code should be executed based on the results of those bindings. 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:with-package[name="kutils"](
@cl:doc(macro condlet) @cl:doc(macro condlet)
@cl:doc(macro condlet*) @cl:doc(macro condlet*)

13
docs/whenlet.lisp Normal file
View File

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