Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Rules & Patterns > Patterns > Pattern (:) >

Pattern


represents the pattern object obj, assigned the name s.
  • The name s must be a symbol.
  • The object obj can be any pattern object.
  • When a transformation rule is used, any occurrence of s on the right-hand side is replaced by whatever expression it matched on the left-hand side.
  • The operator has a comparatively low precedence. The expression is thus interpreted as , not .
  • The form s_ is equivalent to s:_. Similarly, s_h is equivalent to , s__ to s:__, and so on.
Give a name to lists of integers:
Give a name to lists of integers:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF