diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-12-22 13:55:09 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-12-22 13:55:09 -0800 |
commit | d64c62ea9236ee63d4b56ba9945bc6e4c3df967f (patch) | |
tree | 8ef0dd0554e5d57d08e1be73cc99788587823ef8 /txr.1 | |
parent | d9d04630165b65b70feeba43f8ceda8a863d90f5 (diff) | |
download | txr-d64c62ea9236ee63d4b56ba9945bc6e4c3df967f.tar.gz txr-d64c62ea9236ee63d4b56ba9945bc6e4c3df967f.tar.bz2 txr-d64c62ea9236ee63d4b56ba9945bc6e4c3df967f.zip |
Last var may be omitted in iflet/whenlet/condlet.
* eval.c (me_iflet_whenlet): Allow the last binding
to be (init-form) instead of (sym init-form), for
situations in which sym is never used.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -13810,6 +13810,28 @@ Then, the last variable's value is tested. If it is not .code nil then the test is true, otherwise false. +In the syntax, a small convenience is permitted. Instead of the last +.cblk +.meti >> ( sym << init-form ) +.cble +it is permissible for the syntax +.cblk +.meti <> ( init-form ) +.cble +to appear, the +.meta sym +being omitted. A machine-generated variable is substituted +in place of the missing +.meta sym +and that variable is then initialized from +.meta init-form +and used as the basis of the test. This is intended to be useful +in situations in which +.meta then-form +or +.meta else-form +do not require access to the tested value. + In the case of the .code iflet operator, if the test is true, the operator evaluates @@ -13854,6 +13876,12 @@ is returned. (exceeds-p (> fv 150))) (format t "frobosity value ~a exceeds 150\en" fv)) + ;; same as above, taking advantage of the + ;; last variable being optional: + (whenlet ((fv (get-frobosity-value)) + ((> fv 150))) + (format t "frobosity value ~a exceeds 150\en" fv)) + ;; yield 4: 3 interpreted as atom-form (whenlet 3 4) |