Pad array

pad_array is a function that takes an array and either prepends or postpends a number of zeroes specified by the function call.

Syntax

 * BIN = pad_array(ARR, PAD_NUM, DIR)

Argument descriptions

 * ARR: The array which will have zeroes padded onto it.
 * PAD_NUM: The number of zeroes to either prepend or postpend onto ARR. This must be a non-negative integer.
 * DIR: An integer specifying whether to prepend or postpend the zeroes onto ARR. 0 means to prepend, 1 means to postpend, and any other number will throw an error.

Examples
A basic example of how pad_array works.