User Tools

Site Tools


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


$shift(<variable name>)


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.


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.


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.


assign foo blah booya
$shift(foo)              removes "blah" from $foo and returns "blah".
shift_function.txt · Last modified: 2007/08/06 21:25 (external edit)