This feature has long troubled me, I would like to share it.
If Reap
has non-empty set of sown, result looks like:
res = Reap[Sow[a]; b; Sow[c]; Sow[d]; e]
{e, {{a, c, d}}}
If there was no any Sow
we have:
res = Reap[e]
{e, {}}
I'd like to assign resulting list of sown values to a new variable,
even it is empty.
Natural way
newList = res[[2,1]]
not work in second case, we have error:
Part 1 of {} does not exist
so we need some conditional:
newList = If[res[[2]]!={},res[[2,1]],{}]
Is there a way to make it smarter?
UPD
Thanks to all for cool answers, so I'm confused to choose single one