# Why is Reap result nested? [closed]

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)?

• The second element is a list of lists because there may be several different tags sown. Sep 3, 2015 at 0:47
• Example Reap[Sow[1, {x, y}]; Sow[2, y]; Sow[3, x], _, tag] Sep 3, 2015 at 0:48
• Related to this Sep 3, 2015 at 13:56
• Some related answers of mine which I hope may be helpful: (6415), (31076), (44118), (67625) Sep 3, 2015 at 19:08

The second element is a list of lists because there may be several different tags sown. For example,

Reap[Sow[1, x]; Sow[2, y]; result]

(* {result, {{1}, {2}}} *)


Another example by belisarius,

Reap[Sow[1, {x, y}]; Sow[2, y]; Sow[3, x], _, tag]

(* {3, {tag[x, {1, 3}], tag[y, {1, 2}]}} *)