Reputation
76,658
Next tag badge:
283/100 score
18/20 answers
Badges
8 227 320
Newest
 Nice Answer
Impact
~514k people reached

Jan
3
comment Generating assignments and transforming code inside Holding forms when generating code
@ManuelOdendahl Well, thanks, accepting within a few seconds of me posting an answer is impressive, but perhaps you could wait for a bit to at least read it - who knows, may be I got tired and posted a load of junk ...
Jan
3
revised Generating assignments and transforming code inside Holding forms when generating code
deleted 3 characters in body
Jan
3
answered Generating assignments and transforming code inside Holding forms when generating code
Jan
2
awarded  Enlightened
Jan
2
awarded  Nice Answer
Dec
31
awarded  Great Answer
Dec
29
revised Attributes with Pattern test
Added links
Dec
29
comment Attributes with Pattern test
@SimonWoods Good to know, thanks. I wasn't aware that this has been discussed in the docs.
Dec
29
comment Attributes with Pattern test
@Algohi I'd rather say that for patterns of the type p_head /; test[p] or p_head?test, the procedure to match the pattern is that first, the p_head part is tested, and if the pattern doesn't match, the test from Condition or PatternTest is simply not performed. So yes, this is a particular form of short-circuiting, very sensible one IMO. I have discussed it in this answer.
Dec
29
comment Attributes with Pattern test
@Algohi Yes, because _List acts as a prefiltering device. This means that the pattern-matcher stops at that point and does not need to call the test function, because it rejects the pattern at an earlier stage of _List.
Dec
29
answered Attributes with Pattern test
Dec
29
comment how to test if a string containing boxes is syntactically correct?
Ok, I understand now. Indeed, you are right, FE barks on badly escaped strings but is Ok with properly escaped strings even when they don't represent the correct syntax.
Dec
28
comment how to test if a string containing boxes is syntactically correct?
But your last example does lead to red-flagging the cell: it is just x^2 = , which isn't the correct syntax. So at least you need to change it to something else, to illustrate your point. It isn't clear to me, for example, that there exists a single example of "anything that the front end displays without red flagging the cell", on which SyntaxQ gives False.
Dec
28
comment Why isn't Options[] finding all options?
You just have wrong expectations. In general, you can't see the options you passed to a function, in the result of that function's execution. Why should you? It could be e.g. a number, a list, whatever, leaving no trace of the initial arguments. In the case of Plot, what you get as a result is an expression, interpreted in a special way by the FrontEnd. This is why some of the options you pass, may survive and enter the result. But this is a pure accident - it just so happens in this case. You shouldn't count on this. Reconstructing passed arguments from a result is not possible generally.
Dec
28
comment how to test if a string containing boxes is syntactically correct?
It is not clear then, what is your definition of a valid string. I would not call the string in your last example a valid string, because it does not result in a valid Mathematica expression when parsed.
Dec
28
comment how to test if a string containing boxes is syntactically correct?
Have a look at SyntaxQ.
Dec
23
comment How to define a function that is Listable for some but not all arguments?
I have extensively discussed this problem in my book, here and also here, where you will find several possible solutions to it.
Dec
22
comment Recommendations about modifying usage of built-in symbols
@IstvánZachar I would still not do this. I do sometimes use built-ins as option names, but usually as a short-cut, and I never document that (so never really modify those symbols' global properties). And I would never do anything like that in the user-facing code. Any global modification you make to a built-in symbol, can have unanticipated consequences. And the more common the symbol is, the bigger are the chances to mess something up. Given other possibilities (your own names or strings), I just don't see that the the gain is worth the risk.
Dec
21
comment How to make use of Associations?
@saturasl Glad that you liked it. Thanks again for pointing this out. I have seen such effects previously, but did not notice it here when originally posting.
Dec
21
comment Recommendations about modifying usage of built-in symbols
I second the concerns of others. I would never do this. Use your own names or strings, as others have suggested. Changing properties of built-in symbols have an effect on entire system, and you can't know all the consequences. There have been multiple discussions about this here on the site, notably this one, and also here. You can seldom win big by changing built-ins, but it is very easy to mess things up badly.