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/03/03 08:20] – 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 87: | Line 95: | ||
'' | '' | ||
- | Tests if the argument is symbol. All versions of NIL are symbol. | + | Tests if the argument is a symbol. All versions of NIL are symbol. |
<code lisp> | <code lisp> | ||
Line 113: | Line 121: | ||
'' | '' | ||
+ | |||
+ | 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.1646320837.txt.gz · Last modified: 2022/03/03 08:20 by admin