Timeline for Trace of -{1} expression
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 22, 2017 at 16:16 | vote | accept | iot | ||
May 21, 2017 at 13:59 | comment | added | Michael E2 |
@Mr.Wizard I considered it, but I think you have in mind something different than what I had in mind. The only difference, other than an alternative approach to coding negation, is that there is one less step in the evaluation, since the -1 factor is unnecessary. But the speed seems the same. - I'm not sure what it is you see in the example. Consider answering yourself. -- Update: Okay, Minus seems faster on moderate sized arrays of integers.
|
|
May 21, 2017 at 13:53 | answer | added | Michael E2 | timeline score: 12 | |
May 21, 2017 at 12:08 | comment | added | Mr.Wizard |
@MichaelE2 Consider possibly including Minus for the sake of comparison.
|
|
May 21, 2017 at 7:04 | history | tweeted | twitter.com/StackMma/status/866187929705754624 | ||
May 21, 2017 at 4:57 | history | edited | Mr.Wizard |
edited tags
|
|
May 21, 2017 at 4:57 | comment | added | Mr.Wizard | @MichaelE2 Are you going to make that an Answer? | |
May 21, 2017 at 2:50 | history | edited | Alexey Popkov |
edited tags
|
|
May 20, 2017 at 21:28 | comment | added | Michael E2 |
I suspect it's because Range[1] produces a packed array (Developer`PackedArrayQ@Range[1] ), and they have different rules for evaluation than other lists. The difference is more apparent with longer lists, e.g. -{1, 2} vs. -Range[2] .
|
|
May 20, 2017 at 21:01 | history | edited | iot | CC BY-SA 3.0 |
deleted 28 characters in body
|
May 20, 2017 at 20:59 | comment | added | iot |
@MichaelE2, -Range[1]// Trace// FullForm doesn't do transformations that first expression does. Why is it so?
|
|
May 20, 2017 at 20:44 | comment | added | iot |
@Shadowray, no, I want to make a function, that list argument list_List that is to be used as -list . as list is big, Trace is also. I don't know if I sould use other expression
|
|
May 20, 2017 at 20:42 | comment | added | Michael E2 |
Also -{1} // Trace // FullForm reveals some hidden structure.
|
|
May 20, 2017 at 20:37 | history | edited | iot | CC BY-SA 3.0 |
edited title
|
May 20, 2017 at 20:33 | comment | added | J. M.'s missing motivation♦ |
You might find it more informative to use TracePrint[] instead.
|
|
May 20, 2017 at 20:32 | history | asked | iot | CC BY-SA 3.0 |