64,102 reputation
6189283
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 3 years, 2 months
seen 7 hours ago

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


Feb
11
comment Counting the population of integers
Thanks for this comparison. My method "blows up"not because of Tally, but because of Alternatives@@elems` pattern in my post-processing. This was an oversight from my side and can be improved. I will post faster code soon and ping you then.
Feb
11
awarded  Nice Answer
Feb
10
awarded  Nice Answer
Feb
10
comment What are the known differences between Save and DumpSave, and how to account for them?
My comment certainly does not qualify as an answer, or I would have posted it as such :)
Feb
10
comment Counting the population of integers
This is not to detract from the beauty of your solution. However, it simply can not be generically as fast as Tally, because it repeats Count for any element in the list and any sublist, so is based on a fundamentally worse complexity algorithm. This is a second time I see rather meaningless benchamrks coming from you. I have a very high opinion of you as a Mma programmer, but please pay more attention when posting benchmarks - this is a sensitive topic and we want full objectiveness here. Thanks. And +1 for your solution ( but not benchmarks :-)).
Feb
10
comment Counting the population of integers
What is code? Without knowing it, the timings are IMO largely meaningless. If you repeat 10000 times a function call on a small (toy) list, it tells you nothing about the computational complexity of some solution for sizable lists, meaning that you are benchmarking applications to toy lists only. This is, of course, fine, if one is only interested in being ultra-fast on very small lists, but then chances are that bottlenecks will be elsewhere anyway. Normally, one is more interested in larger lists though, for benchmarking. Perhaps, you used large lists in your code, but how would we know?
Feb
10
comment What are the known differences between Save and DumpSave, and how to account for them?
I have encountered similar problem with Save converting delayed UpValues- based definitions to immediate ones (don't remember which one was the culprit - Save or Get), in this answer. Did not really find time to get deeper into it, but have a look at retrieveMainList function there for a work-around and some comments I made about it.
Feb
9
revised Counting the population of integers
refactored the code to minimally change the original OP's approach
Feb
9
answered Counting the population of integers
Feb
9
comment Efficient code for tallying entries in very large lists
@hailekofi ... provided by an iterator. So, you construct some function f which, when called as f[], returns the next result from your collection or set you want to iterate through. Then, the iterator in this setup is iterator[f]. From this point on, the rest of the code knows what to do with this, without being concerned with exactly how your iterator function f works.
Feb
9
comment Efficient code for tallying entries in very large lists
@hailekofi Thanks for the accept :-). I used this opportunity to connect to some of the things I've done earlier. Re: iterator - this is just an abstraction, a data type, if you wish. It is created along the lines of this answer of mine. So, yes, it is a task of the user to construct an iteator for any given specific situation. Basically, the only requirement here is that iterator contains a function which, when called with zero arguments, returns some result. This result will be interpreted as "next" value ...
Feb
9
comment Is Table the only functional way to construct nested loops in Mathematica?
@RunnyKine Right, it is a good habit to not accept immediately. This would motivate others to contribute more answers.
Feb
9
revised Is Table the only functional way to construct nested loops in Mathematica?
Changed to an improved version, per jVincent's suggestion
Feb
9
comment Is Table the only functional way to construct nested loops in Mathematica?
@jVincent Yes, that's true. I have a habit of working with indices,but here they don't bring much of an advantage. Will edit your suggestion in, thanks.
Feb
9
revised Is Table the only functional way to construct nested loops in Mathematica?
added 86 characters in body
Feb
9
answered Is Table the only functional way to construct nested loops in Mathematica?
Feb
8
comment Interrupting package evaluation, handling error
@Murta Catch and Throw are exactly the right tool for this. Good luck with this! Have a look also at this answer of mine. And one more thing: although I don't advocate this, and never really used it for anything serious, you may in really simple cases try GoTo and Label for the scripts. This is a really cheap way to avoid writing functions. Don't take it as my recommendation, but for small scripts this may work, at least as a first, quick and dirty version.
Feb
8
comment Splicing a list of arguments into a function with Sequence
@SimonWoods Thanks :-). I came up with this when writing a book, so just borrowed from there.
Feb
8
comment Interrupting package evaluation, handling error
@rcollyer I agree. But decisions such as at which level which exceptions are handled are in any case a part of a design. Moreover, usually this comes out more or less automatically once you have some experience with this.
Feb
8
comment Interrupting package evaluation, handling error
@rcollyer Finally, for certain languages (such as Scheme) which support continuations, there is a resume mechanism. Even in Java, I suspect this is still possible if one really wants, since one can access the execution stack via reflection (although I personally did not use this much).