XLISP get

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# get

Type: | - | function (subr)
Source: | - | xlbfun.c

## Syntax

(get symbol property)
  symbol - the symbol with a property list
  property - he property name being retrieved
  returns - the property value or NIL

## Description

The 'get' function returns the value of the'property' from the 'symbol'. If the 'property' does not exist, a NIL is returned. The 'symbol' must be an existing symbol. The returned value may be a single value or a list.

Property lists are lists attached to any user defined variables. The lists are in the form of:

    (name1 value1 name2 value2 ... )

Any number of properties may be attached to a single variable.

## Examples

    (setq person 'bobby)                  ; create a variable with a value
    (putprop person 'boogie 'last-name)   ; add a LAST-NAME property
    (putprop person 'disc-jockey 'job)    ; add a JOB property

    (get person 'last-name)               ; retrieve LAST-NAME - boogie
    (get person 'job)                     ; retrieve JOB - disc-jockey
    (get person 'height)                  ; non-existant - returns NIL

    (putprop person '(10 20 30) 'stats)   ; add STATS - a list
    (get person 'stats)                   ; retrieve STATS - (10 20 30)

Note: You can set a property to the value NIL. However, this NIL value is indistinguishable from the NIL returned when a property does not exist.

Common Lisp: Common Lisp allows for an optional default value, which XLISP does not support.

See the get function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference