Skip to main content
10 events
when toggle format what by license comment
Jan 24, 2019 at 14:13 comment added Michael E2 Much of this is discussed under the "Background and Context" section of the doc pages for SameQ, UnsameQ, Equal and Unequal. For instance, "Unequal[Subscript[expr, 1],Subscript[expr, 2]] returns True if Subscript[expr, 1] and Subscript[expr, 2] are numerically unequal, False if they are equal and unevaluated if equality cannot be established." I suppose {} and 3 are not numerically unequal, since {} is not numerical.
Jan 24, 2019 at 13:23 comment added Aharon Naiman @Michael E2, thank you for your reply. Yes, I also played with !SameQ[]. I see that !Equal[] and UnsameQ[] are different, my questions are: why? and why should I have known that? Also, I would appreciate a pointer to some documentation, explaining why {}!=3 does not return False. Thank you.
Jan 23, 2019 at 22:13 history edited m_goldberg CC BY-SA 4.0
deleted 14 characters in body; edited title
Jan 23, 2019 at 21:01 comment added Michael E2 Perhaps you want Replace[list, x_ /; x =!= 3 -> w, 1] or Replace[list, x_ /; x =!= 3 -> w, Infinity]
Jan 23, 2019 at 21:00 comment added Michael E2 ! SameQ[] would be {-7, 3, 2} /. x_ /; ! (x === 3) -> w, which returns the same as UnsameQ[]. But ! Equal[] is different than UnsameQ[], as your 2nd and 4th examples show.
Jan 23, 2019 at 20:53 answer added MikeY timeline score: 3
Jan 23, 2019 at 18:05 answer added GenericAccountName timeline score: 6
Jan 23, 2019 at 15:26 comment added Aharon Naiman @Kuba, thank you for your reply. However, I do not fully understand. Apparently in the UnsameQ[] case, the entire {-7,3,2} is becoming x (/after/ the first level?) and not the same as 3. Why does that not continue with Unequal[]? (For that matter, I am a tad stymied why {}!=3 does not return False.)
Jan 23, 2019 at 14:37 comment added Kuba {a} /. _ -> "who said it works only at the first level?" and {} != 3 vs {} =!= 3.
Jan 23, 2019 at 14:26 history asked Aharon Naiman CC BY-SA 4.0