This shows you the differences between two versions of the page.
cl:functions:get-properties [2019/09/14 05:00] |
cl:functions:get-properties [2021/01/26 04:00] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Function GET-PROPERTIES ====== | ||
+ | |||
+ | ====Syntax==== | ||
+ | * **get-properties** //plist indicator-list// → //indicator, value, tail// | ||
+ | ====Arguments and Values==== | ||
+ | |||
+ | * //plist// - a //[[CL:Glossary:property list]]//. | ||
+ | * //indicator-list// - a //[[CL:Glossary:proper list]]// (of //[[CL:Glossary:indicator|indicators]]//). | ||
+ | * //indicator// - an //[[CL:Glossary:object]]// that is an //[[CL:Glossary:element]]// of //indicator-list//. | ||
+ | * //value// - an //[[CL:Glossary:object]]//. | ||
+ | * //tail// - a //[[CL:Glossary:list]]//. | ||
+ | |||
+ | ====Description==== | ||
+ | **[[CL:Functions:get-properties]]** is used to look up any of several //[[CL:Glossary:property list]]// entries all at once. | ||
+ | |||
+ | It searches the //plist// for the first entry whose //[[CL:Glossary:indicator]]// is //[[CL:Glossary:identical]]// to one of the //[[CL:Glossary:objects]]// in //indicator-list//. If such an entry is found, the //indicator// and //value// returned are the //[[CL:Glossary:property indicator]]// and its associated //[[CL:Glossary:property value]]//, and the //tail// returned is the //[[CL:Glossary:tail]]// of the //plist// that begins with the found entry (i.e. whose //[[CL:Glossary:car]]// is the //indicator//). If no such entry is found, the //indicator//, //value//, and //tail// are all **[[CL:Constant Variable:nil]]**. | ||
+ | |||
+ | ====Examples==== | ||
+ | <blockquote> | ||
+ | ([[CL:Macros:defparameter]] *x* '()) <r>*X*</r> | ||
+ | ([[CL:Macros:defparameter]] *indicator-list* '(prop1 prop2)) <r>*INDICATOR-LIST*</r> | ||
+ | ([[CL:Functions:getf]] *x* 'prop1) <r>[[CL:Constant Variable:nil|NIL]]</r> | ||
+ | ([[CL:Macros:setf]] ([[CL:Functions:getf]] *x* 'prop1) 'val1) <r>VAL1</r> | ||
+ | ([[CL:Functions:eq]] ([[CL:Functions:getf]] *x* 'prop1) 'val1) <r>[[CL:Glossary:true]]</r> | ||
+ | (get-properties *x* *indicator-list*) | ||
+ | <r>PROP1 | ||
+ | VAL1 | ||
+ | (PROP1 VAL1)</r> | ||
+ | *x* <r>(PROP1 VAL1)</r> | ||
+ | </blockquote> | ||
+ | |||
+ | ====Side Effects==== | ||
+ | None. | ||
+ | |||
+ | ====Affected By==== | ||
+ | None. | ||
+ | |||
+ | ====Exceptional Situations==== | ||
+ | None. | ||
+ | |||
+ | ====See Also==== | ||
+ | **[[CL:Functions:get|Function GET]]**, **[[CL:Functions:getf|Function GETF]]** | ||
+ | |||
+ | ====Example Implementation==== | ||
+ | To be done. | ||
+ | |||
+ | ====Notes==== | ||
+ | None. | ||
+ | |||
+ | \issue{PLIST-DUPLICATES:ALLOW} |