ch2_3_predic
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ch2_3_predic [2022/02/20 06:43] – admin | ch2_3_predic [2022/03/30 04:28] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
**// | **// | ||
- | Simple functions that return '' | + | Simple functions that return '' |
'' | '' | ||
Line 17: | Line 17: | ||
'' | '' | ||
- | Tests if two things are the same, is case and type senstive. | + | Tests if two things are the same, is case and type senstive. |
+ | |||
+ | <code lisp> | ||
+ | >(equal " | ||
+ | NIL | ||
+ | |||
+ | >(equal 1 1.0) ; different type | ||
+ | NIL | ||
+ | </ | ||
'' | '' | ||
Line 64: | Line 72: | ||
Tests if the argument is a list, that means cons-cell or nil. | Tests if the argument is a list, that means cons-cell or nil. | ||
- | |||
- | '' | ||
- | |||
- | Tests if the argument is a proper list. Proper list means list ending with '' | ||
<code lisp> | <code lisp> | ||
Line 76: | Line 80: | ||
T | T | ||
- | > | + | >(listp (cons 'a 'b)) ; this is conscell with B in cdr, improper list |
+ | T | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | Tests if the argument is a proper list. Proper list means list ending with '' | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
NIL | NIL | ||
</ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is a symbol. All versions of NIL are symbol. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | |||
+ | > | ||
+ | NIL | ||
+ | |||
+ | > | ||
+ | T | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is a string. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | |||
+ | > | ||
+ | NIL | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is a number (integer or float). | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | |||
+ | > | ||
+ | T | ||
+ | |||
+ | > | ||
+ | ;Division by zero. | ||
+ | NIL | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is a integer number. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | |||
+ | > | ||
+ | NIL | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is number zero. | ||
+ | |||
+ | <code lisp> | ||
+ | >(zerop (- 10 10)) | ||
+ | T | ||
+ | |||
+ | >(zerop nil) | ||
+ | ;Applying ZEROP on non-numeric data type! | ||
+ | NIL | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is an odd integer. | ||
+ | |||
+ | <code lisp> | ||
+ | >(oddp 3) | ||
+ | T | ||
+ | |||
+ | >(oddp 3.0) | ||
+ | ;Applying ODDP on non-integral number! | ||
+ | NIL | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is an even integer. | ||
+ | |||
+ | <code lisp> | ||
+ | >(evenp 2) | ||
+ | T | ||
+ | |||
+ | >(evenp 0) | ||
+ | T | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is a function object. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Tests if the argument is a package object. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Expects symbol as argument. Tests if the symbol has value binding. | ||
+ | |||
+ | <code lisp> | ||
+ | >(boundp 'pi) | ||
+ | T | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Expects symbol as argument. Tests if the symbol has function or macro binding. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | T | ||
+ | |||
+ | > | ||
+ | T | ||
+ | </ | ||
'' | '' | ||
+ | |||
+ | Expects symbol as argument. Tests if the symbol represents special operator. | ||
+ | |||
+ | <code lisp> | ||
+ | > | ||
+ | NIL | ||
+ | |||
+ | > | ||
+ | T | ||
+ | </ | ||
ch2_3_predic.1645364603.txt.gz · Last modified: 2022/02/20 06:43 by admin