Timeline for How do I evaluate only one step of an expression?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 8, 2012 at 10:01 | comment | added | Mr.Wizard |
WReach this answer can be greatly simplified using TraceLevel[] as in: TraceScan[Print[TraceLevel[], " : ", ##] &, Sin[x]^2 + b]
|
|
Feb 8, 2012 at 6:19 | comment | added | Mr.Wizard | Thank you. I am glad that this appears to be passing the logic check as I really want this function to be robust; it would be very useful. | |
Feb 8, 2012 at 5:42 | comment | added | WReach |
@Spartacus Very clever. TraceDepth -- well spotted! And a cheeky way to pick out the second evaluation. The definition certainly seems to handle conventional definitions correctly. Yes, it is useful. Well done. And +1.
|
|
Feb 8, 2012 at 0:09 | comment | added | Mr.Wizard | Please tell me if the answer I added below is useful to you (and also if it works as I believe it does). | |
Jan 22, 2012 at 16:52 | comment | added | WReach |
@Mr.Wizard Yes, that would seem to be a reasonable heuristic as well. I show the TraceScan solution because it offers the possibility of short-circuiting the evaluation if the right heuristic can be found -- a heuristic that has eluded me so far.
|
|
Jan 22, 2012 at 7:15 | comment | added | Mr.Wizard |
Thank you for a lengthy reply. I have not walked through the code, but I notice you state: "the solution relies upon running the evaluation to completion." If I accept that I think it would work to use a simple Trace and just pick the first object for which Head[#] =!= List && # =!= HoldForm[original] . What do you think?
|
|
Jan 21, 2012 at 18:59 | history | answered | WReach | CC BY-SA 3.0 |