User Tools


Differences

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

Link to this comparison view

cl:functions:fboundp [2019/06/15 02:00]
cl:functions:fboundp [2019/06/19 03:00] (current)
Line 1: Line 1:
 +====== Function FBOUNDP ======
 +
 +====Syntax====
 +  * **fboundp** //name// → //​generalized-boolean//​
 +
 +====Arguments and Values====
 +  * //name// - a //​[[CL:​Glossary:​function name]]//.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​.
 +
 +====Description====
 +Returns true if //name// is //​[[CL:​Glossary:​fbound]]//;​ otherwise, returns false.
 +
 +====Examples====
 +<​blockquote>​
 +(fboundp '​[[CL:​Functions:​car]]) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +(fboundp '​[[CL:​Functions:​nth-value]]) <​r>//​[[CL:​Glossary:​false]]//</​r>​
 +(fboundp '​[[CL:​Macros:​with-open-file]]) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +(fboundp '​[[CL:​Special Operators:​unwind-protect]]) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +
 +([[CL:​Macros:​defun]] my-function (x) x) <​r>​MY-FUNCTION</​r>​
 +(fboundp '​my-function) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +([[Cl:​Special Operators:​let]] ((saved-definition ([[CL:​Functions:​symbol-function]] '​my-function)))
 +  ([[CL:​Special Operators:​unwind-protect]]
 +      ([[CL:​Special Operators:​progn]]
 +        ([[CL:​Functions:​fmakunbound]] '​my-function)
 +        ([[CL:​Functions:​fboundp]] '​my-function))
 +    ([[CL:​Macros:​setf]] ([[CL:​Functions:​symbol-function]] '​my-function) saved-definition)))
 +  <​r>//​[[CL:​Glossary:​false]]//</​r>​
 +(fboundp '​my-function) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +([[CL:​Maros:​defmacro]] my-macro (x) `',x) <​r>​MY-MACRO</​r>​
 +(fboundp '​my-macro) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +([[CL:​Functions:​fmakunbound]] '​my-function) <​r>​MY-FUNCTION</​r>​
 +(fboundp '​my-function) <​r>//​[[CL:​Glossary:​false]]//</​r>​
 +([[CL:​Special Operators:​flet]] ((my-function (x) x)) 
 +  (fboundp '​my-function)) ​
 +  <​r>//​[[CL:​Glossary:​false]]//</​r>​
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Should signal an error of type type-error if //name// is not a //​[[CL:​Glossary:​function name]]//.
 +
 +====See Also====
 +  * **[[CL:​Functions:​symbol-function|Function SYMBOL-FUNCTION]]**
 +  * **[[CL:​Functions:​fmakunbound|Function FMAKUNBOUND]]**
 +  * **[[CL:​Functions:​fdefinition|Function FDEFINITION]]**
 +
 +====Notes====
 +It is permissible to call **[[CL:​Functions:​symbol-function]]** on any //​[[CL:​Glossary:​symbol]]//​ that is //​[[CL:​Glossary:​fbound]]//​.
 +
 +**fboundp** is sometimes used to "​guard"​ an access to the //​[[CL:​Glossary:​function cell]]//, as in: 
 +<​blockquote>​
 +(if (fboundp x) (symbol-function x))
 +</​blockquote>​
 +
 +Defining a //​[[CL:​Glossary:​setf expander]]//​ //F// does not cause the //​[[CL:​Glossary:​setf function]]//​ ''​(setf //​F//​)''​ to become defined.
 +
 +\issue{FUNCTION-NAME:​LARGE} \issue{SETF-FUNCTIONS-AGAIN:​MINIMAL-CHANGES}