56,887 reputation
5160252
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 37
visits member for 2 years, 7 months
seen 10 secs ago

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


Aug
18
comment Programmatic formatting for Mathematica code - possible?
@Silvia Sounds good! By now I am fully convinced that such an IDE is possible, realistic, and is a good idea. I have been using some core parts of it to structure my work for almost a year now. The hardest problems are to get the design right on all levels, and to accumulate some critical mass of the functionality that, working together, can support really simple but powerful workflows. Doing this is a lot of work, and of a kind that needs continuous chunks of free time. Right now I feel I am very close to that critical mass.
Aug
17
comment Programmatic formatting for Mathematica code - possible?
@Silvia .. then it will make it less convenient. Generally, I am working on a full-fledged FE-based IDE, and I have made some good advances recently. The main idea is to make notebook-based approach scalable for large code bases, by providing convenient navigation etc in the notebook environment. Very soon I will have a version for "alpha-testing". If you'd like to test it, I will send you a copy (I intend this to be MIT-licensed). We could perhaps join forces at some point, as you seem to be interested in the same sort of things.
Aug
17
comment Programmatic formatting for Mathematica code - possible?
@Silvia Having on-the fly formatter is a different story though, it may have its own issues to solve. I didn't think about it yer, although I agree that it would be nice. Re: code folding - I also did experiments similar to things I see on the screen shot. I did rather many of such. The final conclusion I came to is that dressing editable code with such constructs will generally make it too fragile to be always sure that what you execute is what you meant. In other words, the robust way to do this would then be to distinguish "read-only" code (which can be foldable), from editable code. But ..
Aug
17
comment Programmatic formatting for Mathematica code - possible?
@Silvia Re: speed of formatter - the formatter is deeply recursive, and that recursion is rather non-trivial. It basically makes several passes through the code. I think, the main slowness is due to the fact that the transformations related to tabification are non-trivial. We should think of them more like compilation. You can look at the output after the tabify / format, but before preformat, for some longer pieces of code, and chances are that you'll see rather large expressions. That said, it may well be that the formatter can be seriously optimized - I just didn't look into it.
Aug
15
comment Programmatic formatting for Mathematica code - possible?
@Silvia Thanks a lot, I do appreciate! Re: recursive - in my experience, recursion in such problems is the most clean, flexible and powerful method. The speed has not been too critical for me so far, and even when it is, I am not at all sure that the bottleneck is due to the use of recursion. You might succeed in using rule replacements (ReplaceAll and ReplaceRepeated) instead, but in my experience they are inferior for harder problems, particularly those which are naturally recursive (like the case at hand).
Aug
9
comment How to make use of Associations?
Re: like dictionaries - to me, some of the more valuable parts of assocs are immutability and transparency on several levels of depth. The former allows to do things not easily possible otherwise (real fp on assocs), and the latter often saves a lot of boilerplate code and reduces complexity. Re: not garbage-collected - I'd think so. I did not do extensive tests, but since you return it from Module as a part of another expression, I'd think you will need to take care of its destruction yourself. If I am wrong, all the better! I will check this soon.
Aug
8
comment How to make use of Associations?
@rm-rf In general, I can tell that the addition of Associations made the language much more powerful, as far as I am concerned, particularly together with operator forms (for which we should thank a number of folks, Tali and Daniel in particular). I can already see that my code patterns have transformed and evolved significantly, to the extent that removing Assocations from the language now would make me feel helpless. One clear sign of importance of a given feature is that it not just simplifies some tasks, but change the ways you think and use the language, which is the case for me here.
Aug
8
comment How to make use of Associations?
@rm-rf A very nice and inventive application, of course you've got my vote. It is somewhat similar in spirit to the trick I am using above in my third version of the object implementation, but in your case it serves a somewhat different purpose. You probably still have to manage the Module-generated symbol, but the complexity reduction from managing complex structure to just a single symbol is quite significant. I can't make immediate examples, but this way of thinking is surely worth exploring much more. One may try to use Associations for novel ways to construct general data structures.
Aug
3
comment Why does list assignment with a packed array result in unpacked values?
@Mr.Wizard Well, I think this was kind of easy to guess, since the pattern matcher has no way to not unpack for this particular rule.
Jul
29
comment Benefit of using Dataset to collect SQLSelect output
It has been discussed in chat several times, around the date of the release, that Dataset currently is optimized to work with hierarchical data, rather than tabular. There are plans to add SQL-like backend(s) to Dataset, which will enable efficient manipulation of tabular data, but those will likely not be based on Associations in the same manner as Dataset is (namely, one Association per row in a db).
Jul
27
comment How to avoid nested With[]?
@QuantumDot The Let part comes from an analogy with Lisp, where there is a similar function. The L stands for Leonid, because originally there was a mathgroup thread with different implementations, and I had to somehow differentiate mine from the others.
Jul
26
comment AssociationMap to query Dataset across levels?
@alancalvitti I think, at some point, when you make your queries more and more general, you have two choices: either use internal Dataset wrappers, as you do, or write your own custom transformation, using only raw lists and associations, and not using the Dataset syntax. In any case, for your last comment, the recommendations of WReach may be the way to go.
Jul
26
comment AssociationMap to query Dataset across levels?
@alancalvitti See if my edit works for you.
Jul
26
comment AssociationMap to query Dataset across levels?
@alancalvitti I was using your own function foo. Now you say you don't want to use it. Your question, precisely, was "Is there a way to avoid inefficient downcasting to Normal and back to Dataset to use AssociationMap?", asked about your last line of code, - and this was precisely what I was answering. I will revisit this later if I have the time. Try to formulate your questions better, at least if you care about me answering them - this is not the first time I found your formulations vague, while I usually do not mis-interpret questions, and certainly have other things to do as well.
Jul
23
comment What is the story with Removed symbols?
@VladimirReshetnikov Interesting. Looks like a bug to me (the second behavior). The concept, as I understand it, is to have Removed as a print form, not as a full-fledged head. So that the symbols that have been removed, are cleared from all definitions, and no longer associated with their names (although, apparently, they can still be used in certain ways, as I outlined in my answer).
Jul
21
comment Struct equivalent in Mathematica?
@Reb.Cabin All right, then I know whom to bombard with stupid questions when I finally get my hands on it :)
Jul
21
comment Struct equivalent in Mathematica?
@Reb.Cabin I am going to do that, in fact. Clojure stands high on my to do list. Thanks for the suggestion, anyway!
Jul
21
comment How to make use of Associations?
@Nasser No, there isn't. In fact, your suggestion might be better, since it will preserve the order of the key.
Jul
20
comment Why is AllTrue much slower than VectorQ?
@Mr.Wizard Alas, no. There was some other discussion, where I was mentioning the speed of VectorQ[..., NumericQ] in my answer. I seem to remember that Szabolcs also posted an answer there, also mentioning this.
Jul
19
comment Why is AllTrue much slower than VectorQ?
Re: post vs delete - let's see what others think. Actually, this issue has been already discussed in another place here on SE (as a sub-topic of a wider discussion), but I can't find it now.