User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:consp [2019/07/14 17:00]
cl:functions:consp [2019/09/18 01:00] (current)
Line 1: Line 1:
 +====== Function CONSP ======
 +
 +====Syntax====
 +  * **consp** //object// → //​generalized-boolean//​
 +
 +====Arguments and Values==== ​
 +  * //object// - an //​[[CL:​Glossary:​object]]//​.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​genralized boolean]]//​.
 +
 +====Description====
 +Returns //​[[CL:​Glossary:​true]]//​ if //object// is of //​[[CL:​Glossary:​type]]//​ **[[CL:​Types:​cons]]**;​ otherwise, returns //​[[CL:​Glossary:​false]]//​.
 +
 +====Examples====
 +<​blockquote>​
 +(consp [[CL:​Constant Variable:​nil]]) <​r>//​[[CL:​Glossary:​false]]//</​r>​
 +(consp ([[CL:​Functions:​cons]] 1 2)) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +(consp '()) <​r>//​[[CL:​Glossary:​false]]//</​r>​ ; ≡ (consp '​[[CL:​Constant Variable:​nil]]) ≡ (consp [[CL:​Constant Variable:​nil]])
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====Example Implementation====
 +These are all equivalent:
 +
 +<​blockquote>​
 +(consp //object//)
 +([[CL:​Functions:​typep]] //object// '​[[CL:​Types:​cons]])
 +([[CL:​Functions:​not]] ([[CL:​Functions:​atom]] //​object//​))
 +([[CL:​Functions:​not]] ([[CL:​Functions:​typep]] //object// '​[[CL:​Types:​atom]]))
 +([[CL:​Functions:​typep]] //object// '​([[CL:​Types:​not]] [[CL:​Types:​atom]]))
 +</​blockquote>​
 +
 +====Notes====
 +None.