Reputation
69,243
Next tag badge:
211/100 score
19/20 answers
Badges
6 204 295
Newest
 Nice Answer
Impact
~448k people reached

9h
comment How to avoid nested With[]?
@Federico Thanks, good suggestion! Edited this in.
Jul
30
comment How can I adjust the global input variable of a function to the value of a local variable within the function
Frankly, I don't understand. To me, this is a very clear case of a duplicate. And yet, some discussion emerges, answers are posted, etc. And the answers are not much different (only more narrow) than those given before. And they come from experienced users who should IMO know better. Folks, what's going on - do we really want to encourage duplication of effort? Or am I missing something?
Jul
29
comment How can I adjust the global input variable of a function to the value of a local variable within the function
possible duplicate of How to modify function argument?
Jul
28
comment How does Dataset compare to DataFrame in pandas?
To the closers: while I don't have a very strong opinion here, I personally wouldn't mind having a technical comparison like the one asked here, on the site. I think this is one of the questions that allows us as a community to see the broader technology landscape. The question is not asked in a "which is better" manner, so I think that a reasonably objective feature comparison might be possible.
Jul
28
comment Visualizing Type System Operations
By the way, while debugging some of the TypeSystem bugs, I have written my own tool, also based on TraceScan. But it was more like a traditional debugger - displayed more details, but was much less visual, than yours. If / when time permits, I will publish that code too.
Jul
26
comment Visualizing Type System Operations
@DanielLichtblau Well, I just meant that I would give it more if the voting system would allow more detailed voting than a binary decision (well, ternary, if we include downvoting, but I don't use that). The "big" was only to compare to my own voting on some other q/a-s, not to how the others vote. So you can relax :).
Jul
25
comment Visualizing Type System Operations
This is great, big +1.
Jul
24
comment Match a variable name pattern
I second the advice of @Szabolcs. I haven't yet seen a single case where such approach would bring any benefits, but have seen plenty where it was a source of varius troubles. Symbols are intended to either store something (i.e. play a role of variables in the programming sense), or just remain symbolic, not storing any value. In either case, their string content should be irrelevant. If you need to know string content, use strings. Symbols and strings are very different things, and conversion from one to the other is something to be avoided, in a symbolic environment, as much as possible.
Jul
20
comment Coding practice Notebooks vs. Packages: ClearAll?
FWIW, I keep ClearAll in my packages, even in production code. I can't see how this can possibly hurt, while this leaves me an option to not clear certain symbols, for example because they receive their definitions in more than one file (which doesn't often happen, but sometimes does, and can not always be easily avoided).
Jul
18
comment Streaming`LazyList`Testing may have a leak
Thanks, your exhaustive answer puts me to shame :). You are right on all points. Somehow, I completely forgot that I have put the unconditional test loading code into the main loader. As to the cyclic dependencies, there is no way to completely avoid them, as far as I can tell, but we are trying to reduce them to the absolute minimum. In 10.2, the coupling between Streaming and Dataset is made weaker, and it will become weaker still.
Jul
18
comment Dataset vs an association of associations
@WReach Thanks. That's pretty useful IMO, not just because of that example itself, but because it demonstrates the non-determinism of type deduction, as you noted.
Jul
16
comment Streaming`LazyList`Testing may have a leak
Can you provide some code that reproduces this? This should not affect anything, because Streaming`LazyList`Testing` should not be on the $ContextPath, but this is certainly not a proper behavior (I am the developer of Streaming module). I will look into this, but it would be easier to do with some code reproducing the problem.
Jul
8
comment How to delete blank valued keys from nested association?
Hello Alexey, good to see you here! +1.
Jul
7
comment Is there a practical way to define a default value for missing keys in an Association?
@Mr.Wizard To add more to my argument, a principal difference between associations and (mutable) hash tables is that assocs can be used with functions like Map etc for data transformations, while hash tables can not, because they are stateful. Now, while we can define e.g. the semantics of Map acting on an assoc with a default: Map[f, AssocWithDefault[assoc, default]] -> AssocWithDefault[Map[f,assoc], f[default]], what would we do with say MapIndexed (which is defined on assocs)? There are also other operators for which the semantics of an assoc with default isn't clear.
Jul
7
comment Is there a built-in equivalent to Python's enumerate?
@RunnyKine Sure, np. At some point I will write up a much more detail tutorial on this stuff, but right now both I don't have the time and the functionality itself has not stabilized. B.t.w., keep in mind that chunk size may affect the performance quite seriously. For large lists, it generally is preferable for best performance to keep chunks large enough, like several thousands elements and more (of course, that also depends on how large the elements are, on the average).
Jul
7
comment Is there a built-in equivalent to Python's enumerate?
If you have some normal list of data, you can use LazyListCreate[lst, size-of-the-chunk], to create a LazyList out of it, with the specified size of teh chunk (length, number of elements, not ByteCount). There are other ways too (also using LazyListCreate), but they are somewhat more involved.
Jul
7
comment Is there a built-in equivalent to Python's enumerate?
@RunnyKine I don't have much time right now to add significant examples, but LazyFold works indeed a little differently from Fold. The function to be folded takes 2 arguments: the previous result (#1), and the next chunk (note: a list of elements, not a single element) (#2). So, for example, to compute a total of a LazyList, you can use Fold[#1+Total[#2]&, 0, lazylist], where for usual lists and usual Fold, you'd use Fold[#1+#2&, 0, list]. Let me know if this makes thing work for you.
Jul
6
comment Is there a practical way to define a default value for missing keys in an Association?
@Mr.Wizard Re - default value: indeed, you are right, it doesn't change. So, I take that critique back. In fact, one constructive suggestion that comes out of this is to be able to specify a default value, or generally, default function, when association is constructed. In fact, at some point during development such thing was discussed internally, but then for some reason it has been discarded. When I get a chance, I will ask, what was the rationale behind not having it.
Jul
6
comment Is there a practical way to define a default value for missing keys in an Association?
@Mr.Wizard ... that new data type into the language. Quite possible, but a lot of work. I might post some version of such solution later, if I have the time. This brings us to an important topic of the lack of subtyping mechanism for core data structures in Mathematica - which would allow one to e.g. subtype an assoc and add some state to it (like one can do in e.g. Python).
Jul
6
comment Is there a practical way to define a default value for missing keys in an Association?
@Mr.Wizard Re: (2): No, it doesn't, but Lookup is the only built-in function providing the default mechanism. One can surely implement one's own handling, but that would be more work, again (3).*"Do all of the benefits of associations cease to exist for some reason? Easy copying and manipulation of values, nested associations, etc. still apply do they not"* - yes, they do not apply any more as long as you want your assoc to be mutable and carry a state. That's precisely the point. You have to then define a new data type that would carry that state together with the assoc, and integrate ...