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

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


Feb
8
comment Why doesn't Mathematica use uniform criteria for validating Options?
@Rojo Yes, I know. Back then, I did not know all that. Those packages were written 4-5 years ago, and definietely need an update / overhaul.
Feb
8
revised Efficient code for tallying entries in very large lists
Added a section on file-backed lists
Feb
7
answered Efficient code for tallying entries in very large lists
Feb
7
comment Why doesn't Mathematica use uniform criteria for validating Options?
@Rojo You really want to look at CheckOptions.m, since PackageOptionsChecks generailizes that to entire packages and adds convenient syntax, but it is quite likely that one does not need to change a single line in it and all changes need to be done on the CheckOptions.m. If this is the case, it would mean that I wasn't totally hopeless 4 years ago (actually, sometimes I think I was much better than than I am now).
Feb
7
comment Why doesn't Mathematica use uniform criteria for validating Options?
@Rojo No, I don't, but this should be relatively easy to incorporate. Don't have much time now, but I will think about updating this soon. Or feel free to do it.
Feb
7
comment Efficient code for tallying entries in very large lists
Since you have data in their entirety, your question looks to me as a duplicate of this one, and you can use my solution there, which implements the idea suggested by @Szabolcs.
Feb
7
comment Efficient code for tallying entries in very large lists
What about the datasets themselves - do they fit in memory in their entirety, or if not, how do you currently store and load / work with them?
Feb
7
comment How can I remove matching sublists from my list?
@QuantumDot Sorry, don't have much time today. Look at the documentation for Reap, it has the third optional argument, which is a function f[tag,collected]. So, #2 simply means a list of results collected by Reap for a given tag. Since I am not interested in the tag itself, #1 is not present in the code.
Feb
7
comment Quick multiple selections from a list
@ChrisDegnen Great. Feel free to update the code in the answer if you feel this change is important.
Feb
7
comment Quick multiple selections from a list
@jVincent Thanks, looks good to me.
Feb
7
revised Quick multiple selections from a list
added 115 characters in body
Feb
7
answered Quick multiple selections from a list
Feb
7
comment FoldWhile and FoldWhileList
Seth, regarding your comments: indeed, I did not implement the capability to use m most recent results. I this is really necessary, then your implementation is likely a way to go, since Fold can not be used to implement this. As to the complexity - I don't think most users have to reimplement it themselves - they could as well come to this page and pick whichever implementation they like the most :).
Feb
7
comment FoldWhile and FoldWhileList
@J.M. Sure, this is a possibility. I usually prefer to not use Catch-Throw when softer methods (such as Return) are sufficient.
Feb
6
comment Strategies for solving problems involving searches
@Rojo Me too (meaning myself here :-))
Feb
6
comment FoldWhile and FoldWhileList
No time to benchmark now, but no, I don't make a copy, at least I don't see any obvious place where I do. Will look into that later.
Feb
6
awarded  Good Answer
Feb
6
comment Highlighting bracketing in Mathematica
My code highlighter generator could do this with some tweaking. Unfortunately, I did not make the bracket - matchings and highlighting routines customizable enough to incorporate coloring brackets on different levels with different colors, so some changes to the code are needed to implement this.
Feb
6
comment FoldWhile and FoldWhileList
@Ajasja I think this (leaking) is an artifact of parsing, since the code is parsed and symbols like ctr created before the binding / variable renaming takes place. As for $ctr, this one is probably created at some intermediate stage in the implementation of Module - perhaps part of this implementation is done in Mathematica code (but not the top-level code). I would actually consider the leaking of ctr$ as a borderline bug, albeit not a very important one.
Feb
6
comment FoldWhile and FoldWhileList
@Ajasja ... enclosed in pure functions, so as soon as the main function (the one using that closure) executes, the garbage collector comes to those variables.