User Tools

Site Tools


unshift_function

Differences

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

Link to this comparison view

unshift_function [2006/08/29 16:08] (current)
Line 1: Line 1:
 +# $EPIC: unshift_function.txt,​v 1.2 2006/08/20 17:37:08 sthalik Exp $
 +======Synopsis:​======
 +$__unshift__(<​variable name> <word list>)
 +
 +======Technical:​======
 +   * If the <​variable name> argument is omitted the empty string is returned.
 +   * If the <word list> argument is omitted the rvalue of $<​variable name> is returned.
 +   * If the value of $<​variable name> is the empty string, then the value of $<​variable name> is set to <word list>.
 +   * If the value of $<​variable name> is not the empty string, then the value of $<​variable name> is set to <word list> plus a space plus the old value of $<​variable name>.
 +   * The new value of $<​variable name> is returned.
 +   * <​variable name> must not be prefixed with a $.
 +
 +======Practical:​======
 +Whereas the "​shift"​ operation removes the first word from a word list
 +(or variable), the "​unshift"​ operation prepends words to the beginning
 +of a word list in a variable and assigns the result back to the variable.
 +
 +======Returns:​======
 +The new value of $<​variable name> after the unshift.
 +
 +======Examples:​======
 +<​file>​
 +assign -foo
 +$unshift(foo blah)      assigns "​blah"​ to $foo and returns "​blah"​
 +$unshift(foo booya) ​    ​prepends "booya " to $foo and returns "booya blah"
 +</​file>​
  
unshift_function.txt ยท Last modified: 2006/08/29 16:08 (external edit)