56,452 reputation
5159252
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 37
visits member for 2 years, 6 months
seen 6 hours ago

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


Jul
12
awarded  Good Answer
Jul
12
comment Is the use of Block to temporarily override definitions inherently unsafe?
Ok, if you say so. Will vote to close then.
Jul
12
comment Is the use of Block to temporarily override definitions inherently unsafe?
This question might be relevant.
Jul
12
comment Swap elements in list without copy
@m_goldberg Thanks for spotting this. Actually, I first posted the comment, then tested and found those error, but got distracted and forgot to paste the correct version.
Jul
12
comment Is Wolfram Language suitable for building web applications?
While the new release has some nice web-app related functionality (particularly when used together with the cloud), it does not IMO qualify as a good general platform for web-development, for a number of reasons. The web - related functionality in M10 is supposed to greatly simplify the process of using WL / Mathematica to do some computations possibly needed by web apps, but this is not a substitute for the standard web stack. Your best bet would be IMO to learn some web framework / language to build the core web app infrastructure, and use M10 / WPL to call WL functionality from there.
Jul
12
comment Swap elements in list without copy
You can use swap = Function[{list,i,j},list[[{j,i}}]] = list[[i,j]],HoldFirst]. Example: lst = Range[10]; swap[lst, 3, 7];lst
Jul
11
comment How to make use of Associations?
@YiWang Insertion time is fast when you don't care where to insert, or insert at the beginning or at the end. I did not benchmark what happens when you insert somewhere in the middle. Besides, in linked lists you usually have some control over the "current position", and I don't see how to do this with Associations. But this has to be investigated further.
Jul
10
comment Why is Return not forcing an exit from my function?
While I agree in general about the undocumented functionality, I think that in this particular case the use of Return with a second argument is a better solution. It is very unlikely that this feature will be discontinued, AFAICT.
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