prepend_item

Description

Returns an array containing all elements from the source array as well as the new element.

The new element is located at the beginning of the array.

Return type

generic array

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

prepend_item(arr, val)

Argument

Type

Optional

Repeatable

Restrictions

arr

array

no

no

none

val

storable

no

no

none

Examples

make_col foo:make_array(1,2,3)
make_col bar:prepend_item(foo, 0)
// [0,1,2,3]

Prepend integer 0 at the beginning of array-type column foo. The resulting array is stored in bar.