setprop

setprop — sets a property value for a symbol.

Syntax

setprop (symbol, property, value)

		

Arguments

symbol

The symbol whose property will be set.

property

A symbol which identifies the property to be set.

value

The new value of the property.

Returns

The previous value for that property, or nil if there was no previous value.

Description

All symbols in Gamma may have properties assigned to them. These properties are not limited by the scope of the symbol, so that a symbol's property list is always global. A property consists of a (name . value) pair. Property lists are automatically maintained by setprop to ensure that each property name is unique for a symbol. A symbol may have any number of properties. A property for a symbol is queried using getprop.

The symbol and property are normally protected from evaluation when setting properties, using the # operator.

Example

Gamma> setprop(#weight,#hilimit,1000);
nil
Gamma> setprop(#weight,#hiwarning,950);
nil
Gamma> setprop(#weight,#lowlimit,500);
nil
Gamma> setprop(#weight,#lowwarning,550);
nil
Gamma> getprop(#weight,#hilimit);
1000
Gamma> getprop(#weight,#lowwarning);
550
Gamma> 
		

See Also

getprop, properties, setprops