XLISP make-symbol

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

# make-symbol

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

## Syntax

(make-symbol symbol-str)
  symbol-str - a string expression
  returns - the new symbol

## Description

The 'make-symbol' function takes a string name 'symbol-str' and creates a new symbol. This symbol is temporary and is not interned [placed] into the symbol hash table *obarray*. If the symbol already exists, no error or action is taken and the old values and property lists remain intact. The 'make-symbol' function returns the symbol as its result.

## Examples

    (defun lookin (sym)                  ; create a function to
      (aref *obarray*                    ;   look inside *OBARRAY*
        (hash sym (length *obarray*))))  ;   and look for a specific
                                         ;   symbol - returns a list

    (lookin "FEE")                       ; returns (CHAR-INT NTH ++)
                                         ;   FEE symbol doesn't exist

    (make-symbol "FEE")                  ; returns FEE symbol
    (lookin "FEE")                       ; returns (CHAR-INT NTH ++)
                                         ;   FEE still doesn't exist

    (intern "FEE")                       ; intern FEE symbol
    (lookin "FEE")                       ; returns (FEE CHAR-INT NTH ++)
                                         ;   FEE does now exist

Note: When you 'make-symbol' a string type symbol like "fingers", this is a lower case symbol. This is different from doing a 'make-symbol' on a string type symbol "FINGERS", which is an upper case symbol. With string type symbols, "fingers" and "FINGERS" are two different symbols. Remember also that normal symbols created by XLISP are automatically converted to upper case.

See the make-symbol function in the XLISP 2.0 manual.

Back to Top

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