Timeline for How to avoid returning a Null if there is no "else" condition in an If construct
Current License: CC BY-SA 3.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:35 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Jul 15, 2015 at 6:04 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 613 characters in body
|
Jul 1, 2015 at 10:45 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 79 characters in body
|
Apr 8, 2015 at 17:30 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 1929 characters in body
|
Nov 29, 2013 at 12:39 | comment | added | Mr.Wizard |
@RunnyKine Thanks! p.s. watch your syntax; it is: ##&[]
|
|
Sep 22, 2013 at 1:07 | comment | added | RunnyKine |
+1. Love the ##[]& trick.
|
|
Sep 21, 2013 at 23:43 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 27 characters in body
|
Sep 21, 2013 at 23:35 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 291 characters in body
|
Aug 13, 2013 at 1:09 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 1683 characters in body
|
Mar 30, 2012 at 13:00 | comment | added | user21 | you are not missing anything - I just find that neither Null nor Sequence should be inserted into the list. I find If[cond, a=result]; a cleaner (a little off the track: it can work with packed arrays). That's all I am trying to say. | |
Mar 30, 2012 at 12:50 | comment | added | Mr.Wizard |
@ruebenko re: "in essence replacing the Null with a Sequence" -- isn't that the idea? The OP has If[. . ., Sequence[]] but it undesirably evaluates to If[. . ., Null] . Using ##&[] fixes it. What am I still missing?
|
|
Mar 30, 2012 at 12:24 | comment | added | user21 | I have the feeling this is in essence replacing the Null with a Sequence; and subjectively makes it harder to read. | |
Mar 30, 2012 at 11:18 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 202 characters in body
|
Mar 30, 2012 at 10:28 | comment | added | Mr.Wizard |
@ruebenko I really don't understand what you are trying to say. Using & effectively prevents (holds) evaluation in If . In a year I most certainly will remember what this code does, barring traumatic brain injury. What's your point?
|
|
Mar 30, 2012 at 10:24 | comment | added | user21 | If you look at it with Trace, you will see that you are just hiding it: If[# > 5, #, ## &[]] & /@ Range[10] // Trace. In have a year you will not remember what your code does. | |
Mar 30, 2012 at 10:13 | history | answered | Mr.Wizard | CC BY-SA 3.0 |