Nyquist Property List Tutorial
Variables and Property Lists
|In general terms, a variable is a symbol which contains a value. The symbol can be any valid name, and its value may be changed (hence "variable"). In Nyquist, the value may be of any data type (for example, a number, a character, or even a sound) and may be changed from one data type to another. Unlike some programming languages, variables do not need to be declared before use - they can just be set, and then they exist.
Setting the value of a symbol "binds" the value to the symbol. A symbol that has no value (not even "nil") is said to be "unbound".
In addition to the value of a symbol, we can also attach properties. This is a way of associating a list of items, each with their own value, to a single variable. Each item is called a key or indicator, and we can give each key a value. This list of items is called a "property list" (or plist for short).
To get the value of a property, we use the GET command.
When getting the value of a property, we do NOT want to evaluate either the variable (symbol) or the key symbol, so we must "quote" both symbols to prevent evaluation.
(GET 'varaiable-name 'property-name) ; Lisp syntax
set v = get(quote(varaiable-name ), quote(property-name)) ; SAL syntax
As an example, if we have a variable called *TRACK* (which we do in version 4 plug-ins), and it has a property called NAME (which it does), then we can "get" the value of that property with:
(GET '*TRACK* 'NAME) ; Lisp
return get(quote(*TRACK*), quote(NAME)) ; SAL
|See also Property List Functions in the XLisp manual.|