11,219 reputation
12254
bio website
location
age 28
visits member for 2 years, 5 months
seen Sep 28 at 18:24

Aug
23
revised Mathematica Destructuring
added 795 characters in body
Aug
23
comment Mathematica Destructuring
@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
comment Mathematica Destructuring
@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
answered Mathematica Destructuring
Aug
23
comment Is there a convenient way to copy/paste text-interspersed SE code snippets into Mathematica?
@R.M I ran the code posted in the answer and the suggested command StackAPI`GetCode["http://meta.mathematica.stackexchange.com/a/307/5"], which returned a set of errors from StringCasesand StringReplace. Seems like the call to the API is failing, returning {"answers" -> {}, "page" -> 1, "pagesize" -> 30, "total" -> 0} from the Import.
Aug
22
answered Is there a convenient way to copy/paste text-interspersed SE code snippets into Mathematica?
Aug
22
comment Arranging elements in a Grid by drag&drop
@Jennifer I added a short description of these variables.
Aug
22
revised Arranging elements in a Grid by drag&drop
added 457 characters in body; added 2 characters in body
Aug
22
answered Problems with setting style options
Aug
22
revised Arranging elements in a Grid by drag&drop
deleted 10 characters in body
Aug
22
comment Arranging elements in a Grid by drag&drop
@YvesKlett The skeleton of the code is something I worked out previusly, where I also used MouseAppearance to change the cursor to the item being dragged, however that code is quite wrangled up in a lot of other stuff, and not generally applicable. If I recall correctly it's quite bothersome trying to get the positions to match exactly when you begin the dragging.
Aug
22
revised Arranging elements in a Grid by drag&drop
Added more nicely enclosed function providing functionality
Aug
22
answered Arranging elements in a Grid by drag&drop
Aug
21
comment Filling between boundaries
@rainer I simply supplied an example. If you want to fill it in alternatively look through the documentation for Filling.
Aug
21
answered Filling between boundaries
Aug
20
awarded  Necromancer
Aug
20
answered Lazy lists of Tuples and Subsets
Aug
20
comment Lazy lists of Tuples and Subsets
@LeonidShifrin I wanted the iteration indexing to match in order to ensure consistency between calling lazySublistsand Sublists, however you could iterate though this in any order you wish. An added benefit of having a function that returns the iteration indices for the n'th subset is that you can for instance carry out a maximization that finds that the 42231'th subset was best, and you automatically know which set it is, without having to put in hooks to retrieve the actual subset alongside the maximization.
Aug
19
answered How to make hollow polyhedra?
Aug
17
revised Lazy lists of Tuples and Subsets
deleted 4 characters in body