All Manuals > LispWorks User Guide and Reference Manual > 40 The LISPWORKS Package

NextPrevUpTopContentsIndex

when-let*

Macro
Summary

Executes a body of code if a series of forms evaluates to non-nil, propagating the results of the forms through the body of code.

Package

lispworks

Signature

when-let* bindings &body body => result

bindings ::= ((var form)*)

Arguments

var

A variable whose value is used in the evaluation of body.

form

A form, which must evaluate to non-nil.

body

A body of code to be evaluated conditionally on the result of form.

Values

result

The result of evaluating body using the value var.

Description

The macro when-let* expands into nested when-let forms.

The bindings are evaluated in turn as long as each returns non-nil. If the last binding evaluates to non-nil, body is executed. Within the code body, each variable var is bound to the result of the corresponding form form.

Example
(defmacro divisible (n &rest divisors) 
  `(when-let* ,(loop for div in divisors 
                     collect (list (gensym) 
                                   (zerop (mod n div)))) 
     t))
See also

when-let


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex