58,907 reputation
6175266
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 9 months
seen 1 hour ago

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


Jan
6
comment Why doesn't Mathematica use uniform criteria for validating Options?
The only reliable way to enforce some standard is to do it on the language level. This is particularly true for languages like Mathematica, which offer a great number of possible ways to solve problems.
Jan
6
comment Why doesn't Mathematica use uniform criteria for validating Options?
@chris I agree that this may be a problem. A related issue is that many new options and especially sub-options have strings as their names, rather than symbols. I expressed my opinion on this in this answer, and I still mostly hold it (in particular, it is harder to search for the string options in the documentation etc), but I also encountered cases where string options may be more appropriate, since that answer.
Jan
6
comment Why doesn't Mathematica use uniform criteria for validating Options?
@belisarius No problem :) As an example of application of that package, you can have a look at another package on the same page, PackageSymbolsDependencies.
Jan
6
comment Why doesn't Mathematica use uniform criteria for validating Options?
@belisarius I actually don't get an error when I execute your code with Import. My point is that consistent checking of options is something not very easy to automate on the language level without introducing yet more constructs to the language. So, it is then at the mercy of a particular developer who may have missed some cases etc. So, if some option value is not validated properly, it should be considered a bug, but my point is that I am unaware of any general mechanism to automate this validation process.
Jan
6
revised Why doesn't Mathematica use uniform criteria for validating Options?
added 964 characters in body
Jan
6
answered Why doesn't Mathematica use uniform criteria for validating Options?
Jan
5
revised Thread over a nested list top to bottom until non-list elements are found
Removed HoldAllComplete since it prevents the attributes from being applied (noted by @Rojo)
Jan
5
comment Thread over a nested list top to bottom until non-list elements are found
@Rojo Yes, you are right. Will edit.
Jan
5
revised Thread over a nested list top to bottom until non-list elements are found
added 6 characters in body
Jan
5
comment Thread over a nested list top to bottom until non-list elements are found
@ecoxlinux But the title still misses the point - what you ask is not mapping on leaves, you rather ask to thread over the lists top to bottom until non-lists are encountered.
Jan
5
revised Thread over a nested list top to bottom until non-list elements are found
Added a paragraph explaining some subtle points.
Jan
5
comment Thread over a nested list top to bottom until non-list elements are found
In the spirit of your last suggestion, one could also do something like Block[{g}, g[list] //. x_g :> Thread[x]]
Jan
5
answered Thread over a nested list top to bottom until non-list elements are found
Jan
2
comment StringMatchQ and Alternatives throws message in init.m
@WReach It is not the first time that I saw Catch failing. It looked like Catch is tied to a particular stack, and in some cases it looks like evaluation is using different stacks for parts of it. I may have just given a wrong explanation, but this is what it looked like. I did not have the time to dig deeper and obtain a fully satisfactory answer for these cases.
Jan
2
awarded  Good Question
Jan
2
comment StringMatchQ and Alternatives throws message in init.m
I can't test right now, can only guess. When one uses Mathematica - style patterns in string-related functions, those patterns get compiled to regexes. This procedure is the likely source of exceptions you see. Why this only happens in the init.m files I have no idea, can't dig deeper at the moment. It could be for example that it relies on Java and Java is not yet available, or may be something else of a similar nature.
Dec
28
comment Write and Read to StreamPosition
My understanding is that it is best to not read and write to the file at the same time. The cursor of a read stream has all the rights to not follow the changes introduced by the write (output) stream. Or, it may block the actual writing until it is closed. In any case, this is an error-prone practice which I would simply avoid. Close one stream, and then work with the other one, and vice versa.
Dec
27
awarded  Good Answer
Dec
27
revised Make mathematica treat $e_i^2$ as numeric
Changed to a more elaborate version that would print everything correctly
Dec
27
answered Make mathematica treat $e_i^2$ as numeric