Menu

stacks

Peter Verbeek
Attachments
stack.gif (24476 bytes)

AutoIt file: Lists.au3

A stack is a last-in-first-out (LIFO) type of data list mostly used for temporarily pushing and popping values onto a stack.

Local $aMyStack = _StackCreate()
_StackPush( $aMyStack, "qwerty" ) ; added to last position
_StackPush( $aMyStack, "abcde" ) ; added to last position
....
If Not _StackIsEmpty( $aMyStack ) Then $Value = _StackPop( $aMyStack ) ; $Value = "abcde" 
Function Description
_StackCreate Creates a stack (LIFO) for pushing and popping values
_StackIsStack Tests if given array is a stack
_StackIsEmpty Tests if stack is empty
_StackClear Clears a stack
_StackPush Pushes (adds) a value onto the given stack at last position
_StackPop Pops (removes) a value from the given stack at last position
_StackPeek Gets the last pushed value without popping (removing)
_StackGet Gets a value of a given position, zero-based
_StackValueInStack Tests if a value is in the stack
_StackSize Gets stack size
_StackToArray Creates an array from the given stack
_ArrayToStack Creates a stack from the given array

For first-in-first-out (FIFO) lists you can use [shift registers].


Related

Pal Wiki: Home
Pal Wiki: shift registers

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.