Table of Contents

# $EPIC: shift_function.txt,v 1.5 2007/08/06 21:25:50 jnelson Exp $

Synopsis:

$shift(<variable name>)

Description:

The function takes only one argument, a variable name. The variable is changed by removing its first word. The function then returns that first word.

Practical:

This function can destructively remove the first word from an lvalue (ASSIGN variable), or non-destructively remove the first word from an rvalue (string of text). This is an essential operation when you are creating LIFOs, FIFOs, or other types of queues.

Returns:

The first word, which is “shifted” off of the variable, or the word list, whichever applies. If a variable name is provided, the variable IS CHANGED.

Examples:

assign foo blah booya
$shift(foo)              removes "blah" from $foo and returns "blah".