《通链参考手册》


Macro AND

●语法设定:

and form* => result*

●参数和值:

form---a form.

results---the values resulting from the evaluation of the last form, or the symbols nil or t.

●详情:

The macro and evaluates each form one at a time from left to right. As soon as any form evaluates to nil, and returns nil without evaluating the remaining forms. If all forms but the last evaluate to true values, and returns the results produced by evaluating the last form.

If no forms are supplied, (and) returns t.

and passes back multiple values from the last subform but not from subforms other than the last.

●例子:

 (if (and (>= n 0)
          (< n (length a-simple-vector))
          (eq (elt a-simple-vector n) 'foo))
     (princ "Foo!"))
The above expression prints Foo! if element n of a-simple-vector is the symbol foo, provided also that n is indeed a valid index for a-simple-vector. Because and guarantees left-to-right testing of its parts, elt is not called if n is out of range.

 (setq temp1 1 temp2 1 temp3 1) =>  1 
 (and (incf temp1) (incf temp2) (incf temp3)) =>  2 
 (and (eql 2 temp1) (eql 2 temp2) (eql 2 temp3)) =>  true
 (decf temp3) =>  1 
 (and (decf temp1) (decf temp2) (eq temp3 'nil) (decf temp3)) =>  NIL 
 (and (eql temp1 temp2) (eql temp2 temp3)) =>  true
 (and) =>  T 

●受制于: 无。

●例外情况: 无。

●更多信息:

cond, every, if, or, when

●说明:

 (and form) ==  (let () form)
 (and form1 form2 ...) ==  (when form1 (and form2 ...))


◇首页 § ◎章节目录 § □内容索引 § ○符号索引 § △术语表 § ※设计草案