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

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


Jan
18
revised Global variable initialization in packages
added 2 characters in body
Jan
18
answered Global variable initialization in packages
Jan
18
comment For any symbol, how can I get the full context-qualified name of the symbol as a string?
@JoelKlein Having UniqueContext[] would be quite handy, and not only for this problem. It would have to be efficient, however (e.g. Contexts[] can be quite slow).
Jan
17
awarded  Yearling
Jan
16
revised For any symbol, how can I get the full context-qualified name of the symbol as a string?
Simplified
Jan
16
revised For any symbol, how can I get the full context-qualified name of the symbol as a string?
changed code style
Jan
16
answered For any symbol, how can I get the full context-qualified name of the symbol as a string?
Jan
16
comment Pattern matching a pattern with patterns
You are free to disagree, as well as I am free to express my opinion :) I fully answered the part which was well-defined, in my opinion. But since you are the one to decide which answer is best for you, all I can say is that IMO the question was vague, and that's what I already did. If at the end you got the information you wanted, that's all that matters at present, but stating question in a more precise fashion would make it easier for us, as well as more useful for future visitors.
Jan
16
comment Pattern matching a pattern with patterns
Have to leave now for today, but my final feeling for all this is that the question is really too vague. There are 3 answers currently, and each interpreted it differently. Unupvoting.
Jan
16
comment Pattern matching a pattern with patterns
@jVincent Yes, this is a good point. I was too careless. Please see the edit.
Jan
16
revised Pattern matching a pattern with patterns
Corrected code
Jan
16
comment Pattern matching a pattern with patterns
What you ask for in your update is a pattern analog of so-called parametrized types (exist in ML family of languages, for example). While very interesting and potentially useful thing, this is IMO quite different from your initial question.
Jan
16
comment Pattern matching a pattern with patterns
@jVincent Sorry, I have no time to address this in full at the moment. It seems to be a rather trivial matter to generalize my solution to address the needs you specified. I started from the expressions you gave as examples, but generalizations are rather straightforward. The main method I presented here is quite general, that's one thing I am sure about. You'd need to be more precise in exactly what extended behavior you want, to generalize my specific code in a meaningful / unambigious/ well defined way. I will come back to it later when I have time, unless someone else does that first.
Jan
16
comment Pattern matching a pattern with patterns
@jVincent Because then, the r.h.s will induce differences reflected as nested lists in alighned sequence, and I'd need to distinguish between those which resulted from patterns and those which resulted from r.h.sides. This would add needless complexity. Besides, the r.h.sides can be quite large/involved, so it would be less efficient as well. Finally, I always try to reuse the highest-level constructs (rule application here), since then there are less chances for errors. Overall, I just think it is cleaner to do it this way.
Jan
16
answered Pattern matching a pattern with patterns
Jan
15
revised Efficiently extracting an array subset given a separate array
Corrected the code, per OP's comments/ observations
Jan
15
comment Efficiently extracting an array subset given a separate array
@ChristopherBowman Yes, you are right. Intersection is not enough. I will edit my answer. Thanks for making this point.
Jan
15
comment Efficiently extracting an array subset given a separate array
@ChristopherBowman Sorry, I don't get your objection. The Intersection takes care of possible extra rows, so this should work. Your modification is quite elegant though, and you can remove the Intersection@@ part with it, I think.
Jan
15
revised Efficiently extracting an array subset given a separate array
Corrected my statement for result differences, and also the result, per OP's corrections of his data
Jan
15
answered Efficiently extracting an array subset given a separate array