58,857 reputation
6175266
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 9 months
seen 7 mins ago

Ok, an obligatory note: opinions expressed here are mine and not those of my employer.


23h
comment Unprotect fails the first time, works on second pass
As a general comment, I would much rather use UpValues on customHead, than add a DownValue to Plus, which is generally a pretty error-prone operation and should be avoided when possible.
1d
awarded  Enlightened
1d
awarded  Nice Answer
1d
awarded  Nice Answer
1d
awarded  Enlightened
1d
awarded  Favorite Question
1d
awarded  Nice Answer
1d
awarded  Good Answer
1d
comment To UpSet or not to UpSet when using MakeBoxes
One observation here which I find interesting is that MakeBoxes is HoldAllComplete. This should mean that it doesn't perform any UpValue search. Yet, UpValue-based definitions do work with it. There must be something rather interesting going on there, but I never had the energy to investigate deeper.
1d
awarded  Good Question
1d
comment Is there a way to stop Export if the file size is too big?
The only reliable way I can suggest is to write your own exporter, which would export in chunks. In such a case, you will be able to inject such constraint into the logic of your exporter. It might be not as hard as it may sound, since in many cases you can use ExportString to export individual chunks (e.g. this is the case for CSV).
2d
comment Metaprogramming in Mathematica
@Reb.Cabin In fact, I wanted to do the same, in the sense of reading Lisp books / learning that stuff, and then trying to get some of that into Mathematica. But I agree, that's a lot of work. Still, I'd really like to do that, at least in part, when I get more time on my hands. For instance, I've written some preliminary code for custom code loader in Mathematica, which would have a real read time, making real read-time macros possible. But serious work in any of those directions requires much more time than I currently have.
Oct
18
answered using memoization with conditional statement
Oct
18
comment DownValue assignment using Apply
+1. I think I will point to a similar discussion I had in my post answering this question.
Oct
17
comment Detect Messages within an expression without losing the return value?
@becko See my edit.
Oct
17
revised Detect Messages within an expression without losing the return value?
Added an alternative version to address the request in comments
Oct
17
comment Detect Messages within an expression without losing the return value?
@becko I think, this spec is underdesigned. What if more than one message is generated during the evaluation? Do you want to evaluate expr2 on every generated message? Also, you will probably need to somehow pass the information about the currently generated message to the expr2. One way of doing this would be to use the syntax withMessageDetection[expr1, {msginfo_Symbol,expr2}], where you refer to whatever symbol you pass as msginfo, inside expr2, if you need that. Another way would be to make expr2 a function of those message parameters. Let me know which you'd prefer.
Oct
17
answered Detect Messages within an expression without losing the return value?
Oct
17
comment Association and rudimentary object-oriented programming
I have discussed this topic a bit in my post on the use of Associations, and also here (not in the context of Associations). I you search this site, and also Wolfram Mathematica tag on Stack Overflow, you will find many more OO-related discussions.
Oct
16
comment How to write complex function definitions at run time?
@Mr.Wizard I saw this question the moment it was asked. Unfortunately, I don't have the time at the moment for anything more than a few comments. But, chances are that I wouldn't produce a better answer here than you did. If I had the time, I'd try to address a problem more generally, but that would require a lot more time than I currently have.