53,182 reputation
5147242
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 37
visits member for 2 years, 3 months
seen 3 hours ago

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


Oct
9
comment Simpler way to fill date gaps with zero values
Wow, that's impressive. It is twice faster than my Java code, on my tests. +1.
Oct
9
comment Simpler way to fill date gaps with zero values
@Murta Good point, I modified the code to handle long lists. But for your test to be fine, you also have to change to dateList = SortBy[RandomChoice[{#, RandomInteger[100]} & /@ drange, 10], First];, so that dates are sorted. Note that for your ranges, my top-level code will be very slow. Note also that I added fast Java code. Finally, if you have really huge gaps (sparse data), you will be much better off by developing some custom data structure and other routines for such data.
Oct
9
revised Simpler way to fill date gaps with zero values
Modified top-level code to handle arbitrary length lists
Oct
8
revised Simpler way to fill date gaps with zero values
Added a faster Java solution
Oct
8
revised Simpler way to fill date gaps with zero values
added 1 characters in body
Oct
8
revised Simpler way to fill date gaps with zero values
added 1 characters in body
Oct
8
answered Simpler way to fill date gaps with zero values
Oct
6
comment Modules that initialize themselves on first call
@GeorgeWolfe No,these are 2 components of the solution: scoping serves to create a persistent variable, and memoization serves to remember the value for subsequent calls. They are independent.
Oct
6
revised Modules that initialize themselves on first call
added 852 characters in body
Oct
6
answered Modules that initialize themselves on first call
Oct
5
comment What are some advanced uses for Block?
@Rojo Actually, very good point - I don't remember now. That example was based on my past memories. I grabbed this code from some old notebook that I wrote for version 5, and I only remember that there was some reason. I have removed it for now, until I recall what was done there. It could be that I did a rewrite and it was actually no longer doing anything useful. In any case, this shows that at least some folks read this pretty carefully, which is really good :-). I added an example on local UpValues,as a compensation of sorts :-).
Oct
5
revised What are some advanced uses for Block?
Removed an example with noUsage, added one with local UpValues
Oct
5
awarded  Nice Answer
Oct
5
comment How to Delete Elements from List1 appearing in List2?
@AnastasiiaAnishchenko No problem :-). Actually, it only works on level 1. You probably meant that elements can be anything, including being themselves lists. Actually, I have developed a more general set of routines for similar kinds of operations, see the UnsortedOperations package on this page
Oct
5
comment What are some advanced uses for Block?
@VF1 This depends on the situation. Sometimes you want to keep them for future calls. Sometimes, however, they are only needed to speed up that single computation, and future calls are unlikely to hit the same arguments. In those cases, keeping these extra defs would just slow down the hash lookup and hog the memory, so they better be removed after the call. Block allows you to do that automatically. B.t.w., a long overdue here on SE question IMO (your main one I mean). Thanks for the accept.
Oct
5
awarded  Nice Answer
Oct
4
revised What are some advanced uses for Block?
Added some examples
Oct
4
revised What are some advanced uses for Block?
edited body
Oct
4
answered What are some advanced uses for Block?
Oct
4
answered LetL and Module efficiency