Can someone help explain it to me:
How does here
e
come out? Whyb
disappears?Reap[Sow[a]; b; Sow[c]; Sow[d]; e]
How does here
4
come out?Reap[Sow[1, x]; Sow[2, y]; Sow[3, x]; Sow[4, y], x]
Thanks a lot!
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityCan someone help explain it to me:
How does here e
come out? Why b
disappears?
Reap[Sow[a]; b; Sow[c]; Sow[d]; e]
How does here 4
come out?
Reap[Sow[1, x]; Sow[2, y]; Sow[3, x]; Sow[4, y], x]
Thanks a lot!
When you have a CompoundExpression
the last expression is the result.
Look at the FullForm
of the expression inside Reap
:
FullForm[HoldForm[Sow[a]; b; Sow[c]; Sow[d]; e]]
In this case, the OutPut
is just e
, the last one. Now when you include the Reap
ing, you get things that are Sow
n in addition to e
. Same explanation goes for the second one.
CompoundExpression
.
$\endgroup$
Jul 29, 2014 at 7:11