Skip to main content
19 events
when toggle format what by license comment
Jun 16, 2020 at 9:23 history edited CommunityBot
Commonmark migration
Apr 18, 2018 at 21:54 comment added user541686 @Roman: oops, just noticed I never replied to your subsequent comment. As I understand it, Unevaluated is just a wrapper that disappears after being Evaluated, kind of like how you could say a lambda (&) is a wrapper that goes away after you call it with [], except that evaluation happens automatically. So that means it will propagate and 'not' go away if it appears inside an Unevaluated (or Hold'ed, etc.) context of its own.
Jan 11, 2018 at 0:38 history edited user541686 CC BY-SA 3.0
deleted 1 character in body
Jan 11, 2018 at 0:13 history edited user541686 CC BY-SA 3.0
added 9 characters in body
Jan 11, 2018 at 0:08 history edited user541686 CC BY-SA 3.0
deleted 36 characters in body
Jan 10, 2018 at 15:05 comment added Roman @Ruslan, the extra step becomes clear when you compare Trace[Unevaluated /@ Unevaluated@{a, b, c}] with Trace[Unevaluated[#] & /@ Unevaluated@{a, b, c}]: in the second one, there's a point where you have (Unevaluated[#1] &)[a] which is converted to (Unevaluated[#1] &)[1] before becoming Unevaluated[1]. So the extra step is "supplying the anonymous function with its argument".
Jan 10, 2018 at 14:29 comment added Roman Thanks Mehrdad for the clarification. It seems that there is a lot of subtlety hidden in the simple statement from the Unevaluated documentation: "Unevaluated works only where it appears; it is not propagated." Sometimes it is propagated a little bit; other times it's not propagated at all; and to tell the difference takes a bit of experimentation.
Jan 10, 2018 at 13:58 vote accept Roman
Jan 9, 2018 at 16:05 history edited Coolwater CC BY-SA 3.0
deleted 4 characters in body
Jan 9, 2018 at 15:51 history edited user541686 CC BY-SA 3.0
added 185 characters in body
Jan 9, 2018 at 15:46 comment added user541686 @Szabolcs: I didn't mean "not listing every difference" is what made it wrong, I meant literally the first sentence ("That is only true if the function has no special attributes.") is simply false. (And yes, pedantically it's true in the mathematical sense of "only if", but false for the normal English sense.) The part about discarding extra arguments is indeed true but doesn't really seem relevant given the question was about a single argument, unless I'm missing something/misunderstanding it. (?)
Jan 9, 2018 at 15:23 comment added Szabolcs There are other differences too, e.g. Function silently discarding extra arguments.
Jan 9, 2018 at 15:21 comment added Szabolcs I wouldn't call not listing every different wrong, but you make a good point. Here's how the very same thing lead to a problem in the parallelization framework: mathematica.stackexchange.com/a/138490/12
Jan 9, 2018 at 14:45 comment added user541686 @Ruslan: Yeah, you're probably not the only one. I had to get my hands dirty and write a whole simulator in Mathematica before really understanding this stuff in the language. It's definitely not easy to get what's really going on if you only use it casually.
Jan 9, 2018 at 14:36 comment added Ruslan Ah, I didn't understand the difference between Unevaluated and Hold.
Jan 9, 2018 at 14:31 comment added user541686 @Ruslan: I'm not sure how to point to it and say "there it is", but if you understand that Unevaluated only suppresses 1 step of evaluation whereas Hold suppresses all steps, then you can see that invoking an extra function with an expression will add an extra evaluation step for the expression. It's simply a consequence of a function's arguments getting evaluated before the function is called. That happens twice in the second example but once in the first (because there are two function calls in the second but one in the first).
Jan 9, 2018 at 13:42 comment added Ruslan OK, so you've showed there exists an extra step. But what exactly is this step?
Jan 9, 2018 at 10:26 history edited user541686 CC BY-SA 3.0
added 89 characters in body
Jan 9, 2018 at 10:20 history answered user541686 CC BY-SA 3.0