- #1
Lucid Dreamer
- 25
- 0
I am trying to use Sow/Reap in Mathematica to replace Append in my code. The problem is that I need to define the tags within my code, but doing so doesn't reap the desired results. A simplified version of my code is
However, if I define my tag outside of Reap, then it works
Any ideas as to how I can define tags within my code?
Code:
Clear[tag];
Reap[tag = {a,b}; Sow[1, a];Sow[2,b];, tag]
Code:
Clear[tag];
tag = {a,b};
Reap[Sow[1, a];Sow[2,b];, tag]
Any ideas as to how I can define tags within my code?