A minimal (toy) example for my question:
i= 1;
Reap[Do[Sow[i = (i + 1)^2], {4}]]
(* {Null, {{4, 25, 676, 458329}}} *)
I presume the entire result is a list with first entry Null
because the Do
loop returns Null
.
But why is the result of the Reap
the nested list {{4, 25, 676, 458329}}
rather than just {4, 25, 676, 458329}
?
An even simpler example:
Reap[Sow[i = 2]]
(* 2, {{2}}} *)
Why last entry {{2}}
instead of {2}
(or perhaps even just plain 2
)?
Reap[Sow[1, {x, y}]; Sow[2, y]; Sow[3, x], _, tag]
$\endgroup$