Timeline for Mathematica Destructuring
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Jun 18, 2014 at 16:20 | comment | added | sebhofer | I just stumbled over this and I have to say I really like it! Using this with the shorthand notation is especially neat! | |
Aug 9, 2013 at 12:43 | history | edited | jVincent | CC BY-SA 3.0 |
Added some additional information from discussions in comments
|
Aug 9, 2013 at 2:57 | comment | added | Mr.Wizard | I just wanted to say that in the time since I doubted the value of this construct I have come to really see the value in it. Critical for me is the behavior that the function does not evaluate until the pattern matches. Please consider placing notice of this behavior conspicuously in your answer. I'd +1 a second time if I could. | |
Aug 29, 2012 at 2:02 | history | bounty ended | CommunityBot | ||
Aug 23, 2012 at 13:46 | history | edited | rm -rf♦ | CC BY-SA 3.0 |
added 39 characters in body
|
Aug 23, 2012 at 13:33 | history | edited | jVincent | CC BY-SA 3.0 |
edited body
|
Aug 23, 2012 at 13:30 | comment | added | Mr.Wizard |
+1 for the RightArrowBar thing, which makes this a lot more usable. You're now set up to collect a 100pt bounty. Congrats!
|
|
Aug 23, 2012 at 13:28 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 3 characters in body
|
Aug 23, 2012 at 13:27 | history | edited | jVincent | CC BY-SA 3.0 |
added 795 characters in body
|
Aug 23, 2012 at 12:58 | comment | added | jVincent |
@Mr.Wizard And another thing, if you call something like f[_Integer]:=code;f[2.3] You get the unresolved "call". If you try to emulate this using your method, you get the unchanged input to the replacement, instead of getting the unresolved "call". To be specific 0.3/._Integer:>code yields 0.3 , while dFunction[{_Integer},code][0.3] yields itself, meaning that your output specifies that you have the unresolved call, rather then just passing on the input to higher functions. Speedwice my best bet is that you win by a factor of 2 due to my version having two pattern checks.
|
|
Aug 23, 2012 at 12:53 | comment | added | Rojo | +1 Now it would be nice to support attributes | |
Aug 23, 2012 at 12:52 | comment | added | jVincent | @Mr.Wizard I didn't claim that it was superior in any way. It's a stylistic choice I sometimes find I have a short function which doesn't do much, so I replace it with an anonymous function, however if the function relies on pattern matching, as is often the case for my MapIndexed functions, I can't easily do this. But with this definition it's no problem. So really it's a style choice. I decided to post it since Mike also commented that it was a shame Function didn't support destructuring. | |
Aug 23, 2012 at 12:47 | comment | added | Mr.Wizard |
I usually like your answers (in fact I know through ♦ magic that I've upvoted your posts more than anyone else), so please don't take offense, but honestly how is that in any way superior to the forms that I show? It looks very clumsy to me compared to triDiagonalQ[mat_] := And @@ Flatten @ MapIndexed[#2 /. {i_, j_} :> # == 0 || Abs[i - j] <= 1 &, mat, {2}]
|
|
Aug 23, 2012 at 12:28 | history | answered | jVincent | CC BY-SA 3.0 |