propeller.push.state

Push states

empty-stack?

(empty-stack? state stack)

Returns true if the stack is empty

example-state

Example of a Push state.

get-args-from-stacks

(get-args-from-stacks state stacks)

Takes a state and a collection of stacks to take args from. If there are enough args on each of the desired stacks, returns a map with keys {:state :args}, where :state is the new state and :args is a list of args popped from the stacks. If there aren’t enough args on the stacks, returns :not-enough-args without popping anything

peek-stack

(peek-stack state stack)

Returns the top item on the stack

peek-stack-many

(peek-stack-many state stack n)

Returns the top n items on the stack, as a chunk. If there are less than n items on the stack, returns the entire stack

pop-stack

(pop-stack state stack)

Removes the top item of stack

pop-stack-many

(pop-stack-many state stack n)

Pops the top n items of the stack. If there are less than n items on the stack, pops the entire stack

print-state

(print-state state)

Pretty-print a Push state, for logging or debugging purposes

push-to-stack

(push-to-stack state stack item)

Pushes an item onto the stack

push-to-stack-many

(push-to-stack-many state stack items)

Pushes a collection of items onto the stack, as a chunk (i.e. leaving them in the order they are in)

stack-size

(stack-size state stack)

Returns the stack size