The following functions manipulate lists. They can also be used to manipulate expressions, as shown in the next section, Manipulating Expressions. A summary of commands with explanations is in Functions for Manipulating Lists or Expressions.
Show( A ); // A = {2, 3, 2, 1, 2, 1};
Show( B ); // B = {2, 3, 4, 1, 2, 1, 2, 1, 2, 1};
Shift Into( a, -1 );
Show( a ); // a = {1, 2, 3, 4};
Reverse Into( a ); // a is now {4,3,2,1}
Show( b ); // b = {4, 3, 2, 1};
Show( s ); // s = {-11, -7.2, 1, 2, 4, 5, apple, cake, cat, Pi()};
Sort List Into( c );
Show( c ); // c = {-2, 2, 5, Pi(), pie};
In-place functions are those that operate on lists or expressions directly. They have From or Into in their names (for example, Remove From and Insert Into). They do not return a result; you have to show the list to see the result. The first argument for an in-place function must be an L-value. An L-value is an entity such as a global variable whose value can be set.
Show( myList );
Show( a );
Show( a );
Show( a );
For the not-in-place functions, you must either state the list directly or else quote a name that evaluates to a list. Such functions do not have From or Into in their names. They return manipulated lists or expressions without changing the original list or expression given in the first argument.
Substitute() and Substitute Into() merit further discussion. Both functions find all matches to a pattern in a list (or expression) and replace them with another expression. Each pattern must be a name. The arguments are evaluated before they are applied, so most of the time you must quote them with an Expr() function.
canine = Expr( dogs );
equine = Expr( horse );
Show( a, b, c );
Substitute Into does the same work, in place:
d = Substitute( a,