Timeline for Why this upvalue doesn't escape from Sum?
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 13, 2017 at 12:55 | history | edited | CommunityBot | replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/ | |
| Jan 2, 2016 at 15:15 | vote | accept | xzczd♦ | ||
| Jan 1, 2016 at 15:18 | answer | added | jkuczm | timeline score: 2 | |
| Dec 31, 2015 at 11:56 | comment | added | xzczd♦ | @jkuczm ……To be honest, I didn't notice the influence of HoldAll. (I thought upvalues can always escape from Hold!) You can elaborate this to an answer. | |
| Dec 8, 2015 at 15:37 | comment | added | jkuczm | Sum has HoldAll attribute so in Sum[x, {x, 1, f[3, a]}] expression, {x, 1, f[3, a]} is not immediately evaluated, so f's up value is not used before evaluation of "body" of Sum function starts. {x, 1, f[3, a]} is evaluated in some unknown place inside "body" of Sum function and that's where f's up value is used, leading to this strange behavior. | |
| Dec 4, 2015 at 14:04 | history | edited | xzczd♦ | edited tags | |
| Dec 4, 2015 at 7:11 | answer | added | M.R. | timeline score: 2 | |
| Dec 4, 2015 at 7:00 | comment | added | xzczd♦ | @M.R. A list is just a expression with head List. My transformation rule should escape from any expression whose head isn't If but it fails on Sum. To see the expected behavior, just try something like sum[x, {x, 1, f[3, a]}]. | |
| Dec 4, 2015 at 6:58 | comment | added | M.R. | What would you like Sum[x, {x, 1, f[3, a]}] to become? | |
| Dec 4, 2015 at 6:43 | comment | added | M.R. | The f in the sum expression is inside a list and so it won't match your pattern. | |
| Dec 4, 2015 at 4:20 | history | asked | xzczd♦ | CC BY-SA 3.0 |