I have been believing in Wolfram language that several forms of application of a function are equivalent:
f[a]
f@a
a//f
a~f~b (*for more than one argument*)
But why the last two rows of codes do not work below?
x := Sum[Sow[i^2, (-1)^i], {i, 10}]
Reap[x]
Reap@x
x // Reap
x~Reap~_
x~Reap~{-1, 1}
Reap[#, {-1, 1}] &@x
x // Reap[#, {-1, 1}] &
which give
{385, {{1, 9, 25, 49, 81}, {4, 16, 36, 64, 100}}}
{385, {{1, 9, 25, 49, 81}, {4, 16, 36, 64, 100}}}
{385, {{1, 9, 25, 49, 81}, {4, 16, 36, 64, 100}}}
{385, {{1, 9, 25, 49, 81}, {4, 16, 36, 64, 100}}}
{385, {{{1, 9, 25, 49, 81}}, {{4, 16, 36, 64, 100}}}}
{385, {{}, {}}}
{385, {{}, {}}}
Are there some peculiarities when Reap
meets Function
?
Reap[#, {-1, 1}] &@Unevaluated[x]
andUnevaluated[x] // Reap[#, {-1, 1}] &
$\endgroup$