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

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


Jul
16
comment Implement settable properties
@Szabolcs This is basically the same idea as what I used here (although not using VG). Didn't suggest it here precisely because of the hanging UpValues problem. +1.
Jul
15
comment Combining key pivoting and lookup operators in Dataset
But what't wrong with your last method (last line)? Why are you not satisfied by it?
Jul
15
comment Normal // Association // Dataset workaround for some user query operators
@alancalvitti My advice to you is to work out this example without Dataset, on the level of pure associations and lists, to see what's going on. This is certainly a much better way to see what's happening, than trial and error with various commands.
Jul
15
comment Normal // Association // Dataset workaround for some user query operators
@alancalvitti Of course. I meant the structure without the Delete part: data[GroupBy[Key@"key1"]]. When we apply First, it removes the list around the value, and then Delete removes they key. Just call Normal on intermediate results and play with it to see what's going on.
Jul
15
comment Normal // Association // Dataset workaround for some user query operators
@alancalvitti Basically, without First, you get a list of all results with this key, as a value for the key in a new assoc. First and Last give the same result only when the keys are unique, because then all groups will be lists with a single element.
Jul
14
comment Normal // Association // Dataset workaround for some user query operators
@Rojo Thanks. Your method is also nice. Shows once again that Dataset is hackable, which is good.
Jul
14
answered Normal // Association // Dataset workaround for some user query operators
Jul
14
comment Using PatternSequence on its own in ReplaceAll?
My impression so far has been that the main advantage of PatternSequenceis that now one can name sequences of patterns for restructuring. This is an important feature, but is not the same as what you are looking for.
Jul
14
comment How do you set attributes on SubValues?
@Mr.Wizard Sorry, I don't. Will look into that later.
Jul
14
comment How to prevent notebook from moving/reshuffling code around while one is typing?
Ok, sorry, I didn't notice that you mentioned that.
Jul
14
comment How do you set attributes on SubValues?
@Mr.Wizard Interesting. But I can't look into it now alas, am off for today. Perhaps you could edit your suggestion in? I will try not to forget to have a look at it tomorrow.
Jul
13
comment How to make use of Associations?
@TedErsek Perhaps I should later add some simple examples to this post, to illustrate those things I mention (immutability, etc). The problem is that the post is already pretty long.
Jul
13
comment How to make use of Associations?
@TedErsek I don't have any formal CS training either (I wish I had though, that would've been very useful for me now). My background has been Theoretical Physics, I switched to programming relatively recently. But the things you mentioned are not as bad or hard as they sound. Anyone with the familiarity of a few languages, like say C, Java and Mathematica, would be able to learn about these things relatively quickly.
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.