Reputation
65,453
Next tag badge:
207/100 score
19/20 answers
Badges
6 194 285
Newest
 Nice Answer
Impact
~408k people reached

Mar
10
revised How to properly inject iterators into table?
Added a different version, fully lexical
Mar
10
answered How to properly inject iterators into table?
Mar
9
comment Is it possible to assign a value where the target is itself a variable
This is kind of hard in Mathematica. One way to do this would be Hold[x]/.OwnValues[x]/.Hold[var_]:>(var = 4) assuming that a is a symbol. If a is a string name, then: ToExpression[x, StandardForm, Function[var, var=4, HoldFirst]].
Mar
4
comment How to destructure local variables?
possible duplicate of A smarter nested With?
Feb
27
comment How can I construct a recursive pattern guard?
@Mr.Wizard Good point! Actually, I completely forgot about that one. My be, because you beat me there :). Anyway, I think that recursive patterns are a very powerful and under-explored technique. I have used more complex versions of it with great effect several times. May be, at some point one of us (you, WReach or myself) would find some time to write a reference post on this topic. Thanks for the ref.
Feb
27
comment How can I construct a recursive pattern guard?
+1. To be pedantic, while the answer you linked to was the correct answer to that question, the solution to avoid recursion for that question was proposed first in my earlier answer to it. Another nice use of recursive patterns can be found in this answer. I have also used recursive pattern in a very similar setting in the menuTreeValidQ function in this answer on generic nested menu implementation, back in 2009.
Feb
25
answered function definition with a given list of parameters: how to use Evaluate[] properly?
Feb
25
comment Permanently fixing a variable in the function
@bills I am generally against such constructs, since they add a dependence on a global variable, in a way that is hard to control, and then it leads to all sorts of troubles. I think, in such cases it is better to either use SubValues: fya[a_][x_]:=f[x,a] (so that then one always uses fya[a] as a "function"), or create a closure at run-time: makeFYA[a_]:= Function[x,f[x,a]], and then fya = makeFYA[a]. The advantage here is that we have a better control.
Feb
25
answered Patterns for destructuring “Function” function arguments
Feb
25
comment Expand an expression to only built in functions
@user26610 Was glad to help. Thanks for the accept.
Feb
24
answered Expand an expression to only built in functions
Feb
24
awarded  Nice Answer
Feb
22
comment Inverse of Times->Sequence
Ok, I did, but don't rush to accept it just yet, let's see what other solutions will be posted.
Feb
22
comment Inverse of Times->Sequence
You could do this: Times @@@ {{a, b, c}}.
Feb
22
answered Functional equivalent of a For loop referring to consecutive elements in a list
Feb
21
awarded  Nice Answer
Feb
21
comment Removing elements from a list which appear in another list
@Mr.Wizard Re: vacation - unlikely to happen very soon, but thanks! Re: your code - no, but this isn't a trivial piece of code. I suspect it would be just as hard even if I wrote it myself and then looked at it after a while. I was only able to fully understand it by reading because I did use or see similar tricks before (but not in this combination and not for this problem, regretfully). It uses somewhat similar ideas as my code is using, but has a more clever and efficient way of constructing a mask to filter out elements from the first list.
Feb
21
comment Removing elements from a list which appear in another list
@Mr.Wizard Oops. You are right. And I've been quite busy recently indeed, so it's not the first time I've been missing the point recently. Perhaps, time to take a break from SE. As to your code, it is quite clever. To make up for my blunder, I forced myself to understand it just by staring at it, without reading your explanation or trying anything out in Mathematica. Very nice! Of course, you got my vote.
Feb
21
comment How to work with Application Project files in Wolfram Workbench?
@Kuba I think your answer is right, and I upvoted it. However, as for the docs, I think they never meant to have <<dir - this was just a bad wording they chose. They meant to say "if the project turns out to be a dir", or something along those lines.
Feb
21
comment Removing elements from a list which appear in another list
Doesn't work when the first list has duplicate elements:lrg = {1, 2, 3, 2, 5, 6, 7}; sm = {3, 5, 2}; fastRF[lrg, sm] --> {1, 2, 6, 7}. Besides, I am surprised that this question was even having so many rather complex answers, given this answer of mine, which seems to be faster than any of these, up to hundreds of thousands of elements. Admittedly, this one came out later. Anyway, if you can make it work without making the code a lot more complex, or losing efficiency, you get my upvote.