Understanding Special Function Call Frames

AutoCAD AutoLISP & Visual LISP

 
Understanding Special Function Call Frames
 
 
 

There are two special function call frames.

The FOREACH frame indicates a call to the foreach function. From the shortcut menu, choose the Local Variables option to display the name and current value of the user-supplied variable and list variables bound by the foreach function. For example, if the following expression were evaluated

(foreach n '(a b c) (print n))

then selecting the Local Variables option displays a Frame Binding window like the following:

This Frame Binding window identifies the user-supplied variable (N), the current value of that variable (A), and the items remaining to be processed in the list supplied to foreach (BC).

The REPEAT frame indicates a call to the repeat function. From the shortcut menu, the Local Variables command displays the special name counter and the current value of the repeat internal counter. The internal counter value is initially set to the integer value passed to repeat, indicating the number of iterations desired. The counter decreases by one at each loop iteration. It shows the number of iterations remaining, minus one.

Note that each repeat expression possesses its own counter, but only one such counter can be added to the Watch window.

AutoLISP functions such as if, cond, and, and setq do not appear on the stack. They are not necessary because their call position may be viewed within the source file in the VLISP text editor window.