61,427 reputation
6185278
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 11 months
seen 5 hours ago

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


Jan
23
comment Overloading second argument of CountryData
@Stefan Long experience... :-). This particular issue is covered in Mathematica book and also David Wagner's book on Mathematica programming.
Jan
22
awarded  Enlightened
Jan
22
comment Overloading second argument of CountryData
@ssch Was glad to help. I think I've run into exactly such problem with ...Data before. Also a good example of when manual rule reordering is really needed. Thanks for the accept.
Jan
22
comment How can I merge two lists in a special way?
+1. You could have used Outer[Append, x, y, 1] instead.
Jan
21
awarded  Nice Answer
Jan
21
answered Overloading second argument of CountryData
Jan
21
comment How can I connect Mathematica to Clojure?
@JoelKlein I think you should've kept this as an answer, just to give another point of entry. Even if this is just a video, at some point I am sure the associated notebook will also be available. This is a valuable piece of information, and keeping that as a comment will reduce its visibility. Besides, comments are not indexed by search engines, and may eventually be deleted. Anyone is free to express their own opinion (by downvoting in particular), but this does not mean that everyone here shares that opinion.
Jan
21
comment Removing elements from a list which appear in another list
@rm-rf I am,sometimes :) I was staring at your answer and comments for it for about 2 minutes when I saw your comment popping up. And I switched to it completely randomly from something else I was doing, not on SE.
Jan
21
comment Removing elements from a list which appear in another list
@rm-rf Without going too deep into this, I'd think you are right. The funny thing is, I wasn't notified of your comment.
Jan
21
comment How can you profile compiled code?
@FaysalAberkane It is possible to intercept generated symbolic C code for functions compiled to C. It should then be possible to write some code analyzer in Mathematica which would connect Mathematica variables and those used in a C program, although such a connection may not always be meaningful.
Jan
21
answered How can I connect Mathematica to Clojure?
Jan
20
comment Interested in knowing what substitutions were made to perform an Integrate[]?
Even if this is possible somehow, given the way Mathematica performs integration, those are not the substitutions you are looking for :). Mathematica does not do the integration as humans do, it first reduces the integral to the most general form possible, and then tries to simplify that. You might have better luck with WolframAlpha which can sometimes show the steps.
Jan
20
comment Removing elements from a list which appear in another list
Just for completeness: the other class of cases where your code gets a bit slower is when almost all elements are deleted, even when there isn't much duplication, for example for large1 = RandomInteger[100000, 10^5]; large2 = RandomInteger[10^5, 10^6];.
Jan
20
comment Removing elements from a list which appear in another list
Yes, I do confirm. But the main reason for why your code is speed-equivalent to mine in your new benchmark is that you used data with very little repetition (almost all elements are unique). When you use my benchmarks, you still see 5-7 times difference. So, your method is optimal for almost unique data. This is not to detract from your solution, of course. I find it quite interesting that you found such a fast one based on rules / hashes, somehow I did not expect this would be possible.
Jan
20
comment Removing elements from a list which appear in another list
It is interesting that the solutions to this problem posted so far fit exactly into the classification I used in my book in terms of efficiency, particularly here - with kguler's solution belonging to "scripting" layer, mine to "system" layer (well, more or less), and yours somewhere between "intermediate" and "system". All are useful, since they realize different compromise points between dev.time/complexity and performance.
Jan
20
comment Removing elements from a list which appear in another list
Sorry, disregard my latest suggestion. This won't work since you really need a hash in your method.
Jan
20
comment Removing elements from a list which appear in another list
Nothing comes to mind at the moment. I think it is naturally speed-bounded by the bottleneck associated with multiple ++ operations on the hash. Short of sorting the lists (which is what I do), I don't see a way to avoid that.
Jan
20
comment Removing elements from a list which appear in another list
Your solution has a potentially better complexity than mine (linear in both lists), but is slowed down by the hash lookup constant,and, more importantly, multiple assignments / hash modifications you perform at run-time. So, the larger the lists, the more your solution is favored. Theoretically, for some large lists, it should become faster than mine. In practice, the lists should probably be very large to observe that.
Jan
20
comment Removing elements from a list which appear in another list
Read the explanation on the page I linked to, it is pretty detailed.
Jan
20
comment Removing elements from a list which appear in another list
Good work. I tried something along these lines but failed to make it simple. This is about 5 times slower than mine for the large lists I tried, but pretty fast for its code size. +1.