Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Parts of Expressions >

Sow

Sow[e]
specifies that e should be collected by the nearest enclosing Reap.
Sow[e, tag]
specifies that e should be collected by the nearest enclosing Reap whose pattern matches tag.
Sow[e, {tag1, tag2, ...}]
specifies that e should be collected once for each pattern that matches a tagi.
  • Sow[e, ...] returns e.
  • By having several identical tagi, a single expression can be made to appear multiple times in a list returned by Reap.
  • Sow[e, {{tag}}] sows an expression with tag {tag}.
Evaluate a sequence of expressions, "sowing" some to be collected by Reap:
In[1]:=
Click for copyable input
Out[1]=
 
Compute a sum, "sowing" i^2 at each step:
In[1]:=
Click for copyable input
Out[1]=
 
Make separate lists for expressions "sown" with different tags:
In[1]:=
Click for copyable input
Out[1]=
 
Reap only expressions "sown" with tag x:
In[1]:=
Click for copyable input
Out[1]=
New in 5
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team