Site Tools


shift_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

shift_function [2007/08/06 21:25] (current)
Line 1: Line 1:
 +# $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 [[what is a word|word]].  The function then
 +returns that first word.
 +
 +======Practical:======
 +This function can destructively remove the first word from an [[lval]]ue 
 +([[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:======
 +<file>
 +assign foo blah booya
 +$shift(foo)              removes "blah" from $foo and returns "blah".
 +</file>
  
shift_function.txt ยท Last modified: 2007/08/06 21:25 (external edit)