stack

stack — lists all functions called so far.

Syntax

stack ()

		

Arguments

none

Returns

A list of all of the functions called up to this point in the execution of the Gamma program.

Description

A function that calls stack is presented in order, with the most recently called function at the end of the function list. stack can be useful for debugging programs by requesting a stack trace when an error occurs.

Example

The following program:

#!/usr/cogent/bin/gamma

function hms_to_sec(hms)
{
    hms = list_to_array(string_split(hms, ":", -1));
    (number(hms[0]) * 60 + number(hms[1])) * 60 + number(hms[2]);
    stk = stack();
}

tocheck = list(12,5,13);
hms_to_sec("tocheck");
princ(stk,"\n");
		

Yields these results:

((hms_to_sec tocheck) (progn (setq hms (list_to_array (string_split hms
 : (neg 1)))) (+ (* (+ (* (number (aref hms 0)) 60) (number (aref hms 1)
)) 60) (number (aref hms 2))) (setq stk #0=(stack))) #0#)

See Also

print_stack