I would like to illustrate to users the use of Apply
with an example.
Plus@@Range[5]
(*15*)
To display what is happening I'm interesting in showing the expression after the List
head has been replaced by Plus
, but before evaluation. I can do it abstractly with an arbitrary symbol:
f@@Range[5]
(*f[1, 2, 3, 4, 5]*)
How do I control the evaluation flow to do the same with f
replaced by Plus
?
Edit:
To be more precise, I was wondering if I could control the evaluation so that the output would be shown as:
Plus[1,2,3,4,5]
With Range[5]
being evaluated, but not Plus
.
Trace@Apply[Plus, lis] // Column
which gives screen shot !Mathematica graphics $\endgroup$