7,031 reputation
1334
bio website
location
age
visits member for 1 year, 4 months
seen 2 hours ago
stats profile views 369

Apr
11
comment When should I, and when should I not, set the HoldAll attribute on a function I define?
While it is true that in both examples you are giving there is no comment on why it is there it is not true that HoldAll is unnecessary. In fact it is necessary in both cases you mentioned and the code shown would not work without it. In general I would aggree that setting HoldAll would be the exception, but probably among the answers on this site here there are an unusual fraction of exceptional examples :-).
Apr
7
comment Sequentially numbering a nested list
I think your question as stated is not entirely well specified: would you want {{a**x},b} to be replaced with {{{1,a**x}},{2, b}} or {{{1, a}**{2, x}},{3,b}}? You should note that the answers given will not all do the same thing for cases like that. I'd expect this could bite you once using it in practice...
Apr
7
comment Sequentially numbering a nested list
Empty arguments are equivalent to argument Null, so Function[,#,Listable] is actually Function[Null,#,Listable], which explains why it's not a syntax error (also Get sometimes complains, so Id' recommend to insert the Null). That form for Function will let you define attribtes with the last argument without forcing named arguments, which sometimes is very helpful. AFAIK this is not documented but has appeared in several posts to mathgroup and maybe also stack exchange. As for the syntax-checker of the front-end: it obviously just doesn't know about that undocumented feature...
Apr
6
comment How to use local variables with indices in a Mathematica Block environment?
@rcollyer: I just added some additional remarks about downvalues, upvalues and subvalues. Hope this is now somewhat clearer.
Apr
6
revised How to use local variables with indices in a Mathematica Block environment?
added 27 characters in body
Apr
6
revised How to use local variables with indices in a Mathematica Block environment?
(hopefully) carified details about downvalue, subvalues and upvalues
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
I think that depends on whether one evaluates Subscript[f,1][2] or Subscript[f,1][2]=6, as discussed elswhere...
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
@Bee: are you following this and the discussion to one of the answers? I'd suggest you have a look at my edit to your question and see if you think this makes sense.
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
@rcollyer: I have now edited the question and made a note about that change.
Apr
5
revised How to use local variables with indices in a Mathematica Block environment?
added correction based on guess and explanation about that correction and guess
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
@rcollyer: sorry, it probably didn't become clear: the error was with me not with you. If you evaluate Subscript[f,1][2] = 6 as the OP did post, then after that Subscript[a,1] will evaluate to itself, as you observed. If instead you evaluate just Subscript[f,1][2] (not setting it to 6), which is what I did, then after that Subcript[a,1] will evaluate to 6, and this is because there is now an additional rule in the DownValues of Subcript which can be checked by evaluating DownValues[Subscript]. My guess is that the OP actually evaluated what I did and not what he posted...
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
@rcollyer: you are right, I think the problem is that you correctly did evaluate Subscript[f,1][2] = 6, which will set a subvalue for Subscript with argument f, not a downvalue for Subscript with argument a. I didn't copy but retyped and evaluated just Subscript[f,1][2] and that then shows the behaviour that @Bee reported. @Bee: what exactly is it that you want to work?
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
@johntfoster: while that in a sense behaves like the OP wants, you would accumulate one rule per call to Subscript[f,_][_] in the downvalues of Subscript (evaluate DownValues[Subscript] to see what I'm talking about). This might not be a problem but could well become one when the function gets called frequently. Also there might be reasons to use Block instead of Module, they serve different purposes...
Apr
5
comment How to use local variables with indices in a Mathematica Block environment?
@rcollyer: Yes of course, it's even what I would expect :-). What are you observing and why would you think it should be different from what the OP writes?
Apr
5
answered How to use local variables with indices in a Mathematica Block environment?
Apr
5
answered Managing formatted usage messages in Wolfram Workbench
Apr
5
answered Delayed evaluation of assignment
Apr
4
revised Notation of partial derivative
just corrected a typo
Apr
4
revised How to visualize/edit a big matrix as a table?
added slight performance improvement
Apr
4
revised How to visualize/edit a big matrix as a table?
added Interpretation wrapper and a panel for nicer looks.