57,072 reputation
5160253
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 37
visits member for 2 years, 7 months
seen 1 hour ago

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


Jul
10
revised How to make use of Associations?
Added a section on structs
Jul
10
awarded  Nice Answer
Jul
10
comment How to make use of Associations?
@MikeHoneychurch Totally agree, Associations are very powerful. I'll add some more stuff to this post soon.
Jul
10
revised How to make use of Associations?
Edited in Tali's comments / suggestions. Added a note on Dataset
Jul
10
comment How to make use of Associations?
@TaliesinBeynon Thanks, Tali, well spotted! I will edit your versions in, and correct my comment. Great to see you here, finally :)
Jul
10
comment How to make use of Associations?
Someone upvoted after a few seconds of this being posted. Either this is a new speed record in reading, or some people have too much trust in me :)
Jul
10
answered How to make use of Associations?
Jul
2
comment How to implement nested With as a single construct using functional programming (Fold)?
No problem at all.
Jul
2
comment How to implement nested With as a single construct using functional programming (Fold)?
Also, technically, Fold does not implement recursion. It actually does the opposite - it kills it, for a rather small subset of all cases where recursion can be used. There are lots of more complex cases where recursion can not be reduced to Fold. And I personally view recursion cleaner and more idiomatic, in lots of cases. And, as I said, strictly more powerful than Fold. This is not to say that I don't appreciate Fold - if you look at the code I posted on this site, you'll see that I use Fold rather frequently.
Jul
2
comment How to implement nested With as a single construct using functional programming (Fold)?
This is not a simple recursion, it is combined with evaluation control. In other words, it is recursive code generation, and you have to think about evaluation. I see absolutely no advantage in using Fold here, but at the point where you start being interested not in just having a solution to the problem, but having it in a specific way, it all becomes speculative. So, in this new formulation I'd consider this either opinion-based, or too narrow. Technically, I don't see here anything deeper than just another exercise in evaluation control. But may be I am wrong. Let's see what others think.
Jul
2
comment How to implement nested With as a single construct using functional programming (Fold)?
Yes, there is, but this will be less natural / harder / less elegant. Since the resulting code expansion is a nested With, recursion is IMO the most natural road to proceed here.
Jul
1
awarded  Guru
Jul
1
comment What's a non-trivial Mathematica program involving conscious choice of stack vs. queue data structure?
The example of a trie used to implement prefix word search here, and particularly its application to the Boggle problem are I think good examples where the right choice of data structures was crucial. The first one also uses a stack to collect letters for words, while the last one also uses linked lists to store partial results.
Jun
30
awarded  Informed
Jun
28
comment String templating
@Szabolcs I had similar strategy for Composition, having instead used my own version of it which wasn't unpacking. I wasn't aware of the fact that Composition no longer unpacks. I just checked on the dev.version, and yes, you are right. Thanks for pointing this out. There is (at least) one more issue with Composition, which is good to know, and which I have discussed here in the section "Fixing some speed problems". I did not re-test now, but it is probably still there.
Jun
28
awarded  Good Answer
Jun
28
awarded  Nice Answer
Jun
28
comment Building sparse array from packed arrays
@VanillaSpinIce Not that I know of (which doesn't mean there isn't). It seems that the unpacking is done in the internal code, which constructs the sparse array. I wrote some code which constructs the sparse array from pieces at lower level, but the unpacking was still there - thus I did not post it.
Jun
28
comment Performance tuning in Mathematica?
@bobthechemist Thanks, updated.
Jun
28
revised Performance tuning in Mathematica?
Added a mention of Associations