Maxima/Algorithms
< Maxima
Stack ( LIFO)[edit | edit source]
![](http://upload.wikimedia.org/wikipedia/commons/thumb/5/5a/Vectors_made_with_Maxima_CAS.svg/220px-Vectors_made_with_Maxima_CAS.svg.png)
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;