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

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).
Jun
23
comment What are the Wolfram Language's relative strengths for machine learning?
To the closers: while I partly agree that the question is a bit broad, it seems to be an important one, and having some good answers for it is important. I also think that the decision of being too broad or not should depend on how much specialized information on a praticular topic is currently available on the site. For ML, there isn't yet much accumulated common wisdom on this site in the context of Mathematica. When we started the site, we had similarly broad questions on other topics (like, e.g., meta-programming), which seem to have proved highly appreciated despite that.
Jun
23
comment Exporting Dataset to WDX format fails
@Mr.Wizard Perhaps. Added.
Jun
23
revised Exporting Dataset to WDX format fails
edited tags
Jun
23
comment Exporting Dataset to WDX format fails
Then, MX should do - since v10 it is cross-platform.
Jun
23
comment SetOptions does not give expected result with Grid
In my post I linked to, I gave a solution that would have almost the same convenience as SetOptions, in terms of setting it once and then just using it, while would be much safer and also would always work (SetOptions is known to not work properly on some functions). Re: app conflict - well, imagine two apps which are used intermittently and both set some option to the same built-in function, but in a different way. Then, unless they call SetOptions in every function they provide, chances are that at least one such app will not work properly.
Jun
23
comment Exporting Dataset to WDX format fails
@halirutan This has been fixed in the sources, although I didn't test specifically WDX.
Jun
23
comment How to avoid nested With[]?
@bdforbes More precisely, Verbatim is used to escape the pattern-matcher. A typical use case would be e.g. MatchQ[_Integer, Verbatim[_Integer]] (gives True), where not using Verbatim would lead to False. If you want to prevent the evaluation of the pattern, you use HoldPattern (which sometimes is also used for escaping, where Verbatim should be used). In any case, I don't see now, why in this particular case Verbatim could've been useful.
Jun
23
comment Exporting Dataset to WDX format fails
This is going to be different for 10.2. Regardless, WDX isn't really the best serialization format to use. To serialize a Dataset, I would use MX instead.
Jun
23
comment Exporting Dataset to WDX format fails
+1, nice analysis. For everyone: be aware that this behavior is very likely to change soon (the name of the hook variable flag, etc). In fact, I did change this for 10.2, where Export would fall back to the standard Export in case when the specialized hook fails.
Jun
23
comment How to avoid nested With[]?
@bdforbes That's a good question. I don't see now, why it is there. But I do recall that it was necessary at some stage. I did have several versions of this function, so presumably that was left from that older code. Unless I am overlooking some subtlety.