## Generated by Codox

# Propeller 0.3.2

# propeller.push.instructions

Push Instructions

### def-instruction

`(def-instruction instruction function)`

Defines a Push instruction as a keyword-function pair, and adds it to the instruction table

### generate-instructions

`(generate-instructions stacks functions)`

Given a sequence of stacks, e.g. :float :integer, and a sequence of suffix function strings, e.g. _add, _mult, _eq, automates the generation of all possible combination instructions, which here would be :float_add, :float_mult, :float_eq, :integer_add, :integer_mult, and :integer_eq, also transferring and updating the generic function’s stack-type metadata. For some vector instructions, the placeholder :elem will be replaced with the stack of the corresponding element type (e.g. for :vector_integer, with :integer)

### get-literal-type

`(get-literal-type data)`

If a piece of data is a literal, return its corresponding stack name e.g. `:integer`. Otherwise, return `nil`.

### get-stack-instructions

`(get-stack-instructions stacks)`

Given a set of stacks, returns all instructions that operate on those stacks only. Won’t include random instructions unless :random is in the set as well

### get-vector-literal-type

`(get-vector-literal-type vector-stack)`

Returns the literal stack corresponding to some vector stack.

### instruction-table

PushGP instructions are represented as keywords, and stored in an atom. They can be either constant literals or functions that take and return a Push state

### make-instruction

`(make-instruction state function arg-stacks return-stack)`

A utility function for making Push instructions. Takes a state, a function to apply to the args, the stacks to take the args from, and the stack to return the result to. Applies the function to the args (popped from the given stacks), and pushes the result onto the return-stack.

If the function returns :ignore-instruction, then we will return the initial state unchanged. This allows instructions to fail gracefully without consuming stack values.

### make-metadata

`(make-metadata function stack)`

Given a generic function, e.g. _dup, and a stack type to instantiate it for, e.g. :char, returns the appropriate stack metadata for that function instance

### opens

Number of blocks opened by instructions. The default is 0.