Skip to main content
28 events
when toggle format what by license comment
May 2, 2017 at 15:26 history edited webcpu CC BY-SA 3.0
added 418 characters in body
S Apr 30, 2017 at 16:05 history mod moved comments to chat
S Apr 30, 2017 at 16:05 comment added Kuba Comments are not for extended discussion; this conversation has been moved to chat.
Apr 30, 2017 at 15:58 comment added webcpu @jjc385 I feel it's difficult to explain it. I haven't noticed that Function Evaluate doesn't really work as expected. So I use some tricks to Force Evaluate expression, such as Map[Identity]. Apart from this, there is another kind of Evaluation, Deep Evaluation, I haven't found the corresponding function for Deep Evaluation, so I don't have much to say about Deep Evaluation. Thanks for your advice. :)
Apr 30, 2017 at 15:56 comment added jjc385 @UnchartedWorks Last thing: You said "BTW, I did demonstrate it in the last part of my answer. For instance, CountAssociation[x3, 2] (0) CountAssociation[{x3}, 3] (0) ". To be clear, you've demonstrated that something is different. You haven't logically demonstrated that your claims about evaluation is correct. (I know the following isn't the case here, but for instance your examples don't preclude a bug in Count.)
Apr 30, 2017 at 15:53 comment added jjc385 @UnchartedWorks It's worth mentioning that this has been labeled as a bug (by the community), and my impression is that packing is intended to be invisible to the evaluation process. Caveat: I've never even heard of packing before reading this question, and I was shocked that FullForm doesn't give complete information about the state of e.g. Range[2]. Though I have read enough of e.g. Leonid's answers to have a vague sense that there's a lot going on under the hood that I don't understand.
Apr 30, 2017 at 15:50 comment added jjc385 @UnchartedWorks I think if you edited your answer to clearly reflect this, people might remove their downvotes. I think the biggest problem here is you've used words like 'evaluation' which have specific (yet irritatingly opaque) meaning for Mathematica in perhaps a more colloquial way, and people misunderstood your meaning. I think clarifying this (and getting uber-experienced users' opinions on what's going on) would be very useful for clarifying my own understanding of the evaluation process.
Apr 30, 2017 at 15:43 comment added webcpu @jjc385 It really depends on how to define an evaluation. For instance, the Association is <|"a" -> "PackedArray"[Integer, "<" 2 ">"]|>, Some people think it's evaluated and this is the irreducible value, I think it's not evaluated or a special form. No matter I know it's a PackedArray or not, if you treat x is a unevaluated symbol, it would be not a surprise to see such a result. Nevertheless, It's good to know it's a PackedArray. BTW, I did demonstrate it in the last part of my answer. For instance, CountAssociation[x3, 2] (0) CountAssociation[{x3}, 3] (0)
Apr 30, 2017 at 15:29 comment added jjc385 @UnchartedWorks As others have mentioned, you have NOT demonstrated your claim. You've shown that something is different between Range[2] and {1,2}, but you have failed to demonstrate that the issue is evaluation. Indeed, others have convincingly argued the difference is in array packing, not evaluation. (Also, I didn't get notified because you didn't ping me with @.)
Apr 29, 2017 at 17:11 comment added webcpu Yes, please check the last code snippet of my answer.
Apr 29, 2017 at 16:34 comment added jjc385 "there are some examples which can prove x3 = Range[2] is not evaluated" -- Could you please provide such an example?
Apr 29, 2017 at 15:35 comment added webcpu Function Range is a known special case. Function Table doesn't have this issue.
Apr 29, 2017 at 15:33 history edited webcpu CC BY-SA 3.0
added 550 characters in body
Apr 29, 2017 at 15:25 history edited webcpu CC BY-SA 3.0
added 550 characters in body
Apr 29, 2017 at 15:08 comment added Stitch @AlexeyPopkov Alexey is correct. To confirm this, we can Remove the x symbol after assigning a1, so x is not needed neither it is used for any evaluation after the first Set.
Apr 29, 2017 at 14:49 comment added Alexey Popkov Output of a1["a"] = x is {1, 2} what proves that x is indeed evaluated. I do not understand why you are arguing against the obviousness.
Apr 29, 2017 at 13:59 comment added webcpu Evaluation has many levels, in this case, x is not force evaluated to irreducible form and x is kept intact.
Apr 29, 2017 at 11:05 comment added Alexey Popkov You completely misunderstand the working of Set which implies immediate evaluation of the r.h.s. The explanation is packing, see the comment I linked above.
Apr 29, 2017 at 10:36 history edited webcpu CC BY-SA 3.0
added 605 characters in body
Apr 29, 2017 at 9:44 history edited webcpu CC BY-SA 3.0
added 50 characters in body
Apr 29, 2017 at 9:39 comment added webcpu Map[Identity] is a sort of force evaluation in this case, so x can't be lazy evaluated.
Apr 29, 2017 at 9:34 comment added webcpu x = {1,2}; a1 = <|"a" -> x|>; OwnValues[a1], the output is {HoldPattern[a1] :> <|"a" -> {1, 2}|>}. Both of outputs are the same. However the result are different, how can you explain that?
Apr 29, 2017 at 9:28 comment added Alexey Popkov Map[Identity] in your code simply unpacks the list, it doesn't affect evaluation of x.
Apr 29, 2017 at 9:26 comment added Alexey Popkov You are completely wrong: check OwnValues as I wrote above! The only (hidden) difference is in packing, see this comment.
Apr 29, 2017 at 9:24 comment added webcpu As I mentioned before, x is not evaluated, otherwise, x should be as same as {1,2}, but it's not true if x is not evaluated.
Apr 29, 2017 at 9:12 comment added Alexey Popkov Related: mathematica.stackexchange.com/a/119607/280
Apr 29, 2017 at 9:07 comment added Alexey Popkov Check x = Range[2]; a1 = <|"a" -> x|>; OwnValues[a1], the output is {HoldPattern[a1] :> <|"a" -> {1, 2}|>}. Hence x is evaluated on creation of the association.
Apr 29, 2017 at 8:56 history answered webcpu CC BY-SA 3.0