setprop

Gamma: Version 4.0
Prev |  | Next

# `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 the Trend Functions section of the Photon Functions chapter (Tutorial One) in the Cogent Tools Demo and Tutorials book for an example of this function used in context.

## See Also

`getprop`, `properties`, `setprops`

Prev | Home | Next
`set`, `setq`, `setqq` | Up | `setprops`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.