set, setq, setqq

set, setq, setqq --  assign a value to a symbol.

Syntax

set (symbol, s_exp)
setq (!symbol, s_exp)
setqq (!symbol, !s_exp)

		

Arguments

symbol

A symbol.

s_exp

Any Gamma or Lisp expression.

Returns

The s_exp argument.

Description

These functions assign a value to a symbol, and are the functional equivalent of the = (assignment) operator. Normally in Gamma the = operator is used for assignment, but these functions give more control over evaluation of symbols and expressions at the point of assignment.

The set function evaluates both of its arguments. setq evaluates only its second argument and setqq evaluates neither of its arguments. The most commonly used of these functions is setq. A symbol's value is the value returned as a result of evaluating that symbol. Symbols constitute the Lisp mechanism for representing variables. These functions can only affect the value of a symbol in the current scope.

Example

    Gamma> setq(y, 6);
    6
    Gamma> setq(x, #y);
    y
    Gamma> set(x, 5);
    5
    Gamma> x;
    y
    Gamma> y;
    5
    Gamma> 
    		

See the PID Controller Class section of the PID Emulator chapter, or the Button Functions section of the GTK Functions chapter (Tutorial One), or the Button Functions section of the Photon Functions chapter (Tutorial One) in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

See Also

Assignment Operators

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