Next Prev Up Top Contents Index

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 Reference Manual - 25 Jul 2003

Next Prev Up Top Contents Index