Reputation
68,523
Next tag badge:
211/100 score
19/20 answers
Badges
6 200 293
Newest
 Enlightened
Impact
~437k people reached

1d
awarded  Enlightened
1d
awarded  Nice Answer
1d
comment Exporting Dataset to WDX format fails
@OleksandrR. I don't know about other architectures, my guess would be that that isn't the case - so only the former, Windows/Mac/Linux on x86. But I may be wrong.
2d
comment Count the sequences in an array
@Algohi Yes, and this is what it should return in this case, if I understood the question correctly.
2d
answered Count the sequences in an array
Jul
1
comment How to define a recursive pattern?
AFAIK, no new answers have been added to that question, but that seems the right place to put this stuff. I might do that as well, or we can collaborate on it. But I think this can wait.
Jul
1
comment How to define a recursive pattern?
@Mr.Wizard You are right, strictly speaking (although the form of the construct is similar). I removed that link, and added some other, including some of those you mentioned.
Jul
1
revised How to define a recursive pattern?
Added / modified links
Jul
1
comment How to define a recursive pattern?
I agree, your form is superior in a number of ways. I think I picked the one with MatchQ simply because it was the first thing that came to my mind, I wasn't revisiting older discussions (including my own answers). Shows once again that one should always check what was done before. Interestingly, while I did remember the SO question on deep pattern matching, I forgot about the more recent one you linked, already on SE. It might be a good idea to have some post eventually that would summarize recursive patterns, perhaps in the design patterns question.
Jun
30
comment How to define a recursive pattern?
+1, good stuff. In fact, I've been well aware of this method - for my purposes I came up with it back in 2009, in this post (the menuTreeValidQ function at the start of the code section). Perhaps, the only reason I didn't include it here was the lack of time for an extended post at that moment. What I didn't realize however, is that there is such a speed difference, although in retrospect this seems rather understandable. In any case, this is a great contribution.
Jun
26
comment Memoization with pure functions?
@Mr.Wizard For smaller projects, code is typically changed frequently, so the write / read ratio is much larger. Also, a very important thing is that for smaller projects, it is typically much easier to directly test the code, and the interactivity and ability to test interactively makes it not as critical to have the code perfectly readable. While for larger pieces of code, often it isn't very easy to immediately run a given piece of it in isolation, and then readability becomes much more important still.
Jun
26
comment Memoization with pure functions?
@Mr.Wizard Well, for large projects, big portions of the code stabilize, and no longer have frequent changes (unless, of course, a decision is made to rewrite that piece of code). However, the code remains "live" - other changes in other places may require generalizations, bugs are being fixed, etc. So, typically every so often the code is read by those who work with it, without necessarily being modified much or at all.
Jun
26
comment Memoization with pure functions?
@Mr.Wizard Here is the thing: the way one works with larger code bases is really different from the smaller ones. The complexity grows, you have to read much more code than you write (typically), and the important factor is to have a continuous flow of thought when you read the code. The point is, pure functions usually are associated with other things but not control flow, so typically when I see such use in code, it breaks the flow of my reading, even if I am well-familiar with the idiom. There are exceptions, surely, but those typically are for really widely used idioms.
Jun
26
comment Memoization with pure functions?
@Mr.Wizard A compromise here would perhaps just be this: withCodeAfter = # & , and then use withCodeAfter - which is probably the best solution here.
Jun
26
comment Memoization with pure functions?
@Mr.Wizard But in defense of my method, it communicates more clearly what's going on. Your method is something that needs some thought when seen in code, and may puzzle the uninitiated. If it becomes widely used by the community and so becomes an idiom, that would change. Still, I would argue that in the large body of code, one pays high price for many compact but cryptic expressions, and quite often that price is just too high. I've been working with rather large code bases in recent years, and my preferences certainly have been affected by the type of work I do. B.t.w., thx for the upvote!
Jun
26
comment Memoization with pure functions?
@Mr.Wizard You know, this form you proposed here simply did not come to my mind :). I agree that it is superior. Very nice! I am off for today, but perhaps will update my answer with your code some time soon. Or feel free to do this yourself.
Jun
25
comment Exporting Dataset to WDX format fails
@AlexeyPopkov I don't know enough about WDX to give a fair comparison, but the main disadvantage is speed (bot sure about cross-architecture, but, frankly, at this point, who cares? 32-bit processors are becoming rare in general-purpose computers). MX is a very fast binary format. WDX is empirically quite slow to Import from / Export to it. Also, while this is a subjective opinion, but right now it looks to me like WDX has no future (not much if any internal developments are using it), while MX seems to have a bright future.
Jun
25
comment Exporting Dataset to WDX format fails
@AlexeyPopkov It is obsolete. Since version 10, MX files became de facto cross-platform (although not cross-architecture, so 32-bit and 64-bit mx files are not compatible with each other).
Jun
24
comment Pros/Cons to updating in place
Should be no problem. There isn't really that much of "in-place" updating in this case - you just store the end-result in the same variable (but the r.h.s. had to create a copy etc for its computation). Usually, this term is used when you update some inner part of a given expression, stored in a variable, without copying the entire expression - in such cases, one may get more substantial benefits in terms of performance / memory consumption (this isn't to say that you used the term incorrectly: what you did certainly can be also called in-place updating).
Jun
23
comment How can I include functions from a package into a CDF file?
I'd have a look at SaveDefinitions option (just a guess. By far not an expert on this).