GNU Info

Info Node: (cl)Assignment

(cl)Assignment


Next: Generalized Variables Prev: Control Structure Up: Control Structure
Enter node , (file) or (file)node

Assignment
==========

The `psetq' form is just like `setq', except that multiple assignments
are done in parallel rather than sequentially.

 - Special Form: psetq [symbol form]...
     This special form (actually a macro) is used to assign to several
     variables simultaneously.  Given only one SYMBOL and FORM, it has
     the same effect as `setq'.  Given several SYMBOL and FORM pairs,
     it evaluates all the FORMs in advance and then stores the
     corresponding variables afterwards.

          (setq x 2 y 3)
          (setq x (+ x y)  y (* x y))
          x
               => 5
          y                     ; `y' was computed after `x' was set.
               => 15
          (setq x 2 y 3)
          (psetq x (+ x y)  y (* x y))
          x
               => 5
          y                     ; `y' was computed before `x' was set.
               => 6

     The simplest use of `psetq' is `(psetq x y y x)', which exchanges
     the values of two variables.  (The `rotatef' form provides an even
     more convenient way to swap two variables; Note: Modify Macros.)

     `psetq' always returns `nil'.


automatically generated by info2www version 1.2.2.9