Prepend

Prepend[expr,elem]

gives expr with elem prepended.

Prepend[elem]

represents an operator form of Prepend that can be applied to an expression.

Details

  • Prepend works on SparseArray objects, returning ordinary lists if necessary.
  • Prepend can be used on Association objects. Single new elements are specified in the form key->value. New values replace older ones if their keys are the same.
  • Multiple elements to prepend to an association can be specified in the form {key1->value1,key2->value2, }.
  • Prepend[elem][expr] is equivalent to Prepend[expr,elem].

Examples

open allclose all

Basic Examples  (3)

In[1]:=
Click for copyable input
Out[1]=

Prepend to an Association:

In[1]:=
Click for copyable input
Out[1]=

Prepend several rules to an Association:

In[1]:=
Click for copyable input
Out[1]=

Generalizations & Extensions  (1)

Applications  (4)

Possible Issues  (1)

See Also

Append  Insert  PadRight  Join  PrependTo

Tutorials

Introduced in 1988
(1.0)
| Updated in 2014
(10.0)