Maxima/Algorithms

Stack ( LIFO)


Stack implementation using list:

/* create stack */ stack:[1]; /* push on stack */ stack:endcons(2,stack); stack:endcons(3,stack); block (  loop,   stack:delete(last(stack),stack), /* pop from stack */   disp(stack), /* display */   if is(not emptyp(stack)) then go(loop) ); stack;