Reputation
31,681
Next tag badge:
171/100 score
19/20 answers
Badges
2 69 139
Newest
 Yearling
Impact
~158k people reached

Jan
24
comment Why is a longer pattern matched rather than a short pattern?
+1 This analysis is correct for ReplaceList which only visits the outermost level. ReplaceAll descends into subparts, so for it there are three valid possibilities (p[a.b, c.d], p[a, b.c.d] . b, a . p[b, c.d.a]). Only one (the first, being the "outermost leftmost") is returned because these possibilities overlap and ReplaceAll only visits any given part once.
Jan
15
comment Average dataset with many repetitions?
@MikeHoneychurch ilian of WRI has acknowledged the singleton list issue on another comment thread.
Jan
15
comment Average dataset with many repetitions?
@MikeHoneychurch Mean alone triggers this bug. WRI claims it was broken in 10.3.0 and fixed in 10.3.1, but on Windows I still see the wrong result in 10.3.1 when Mean is applied to a list containing a single association (no crash though). Merge@Mean is the workaround.
Jan
15
comment Aggregation queries on lists of associations in 10.3
@ilian I see you marked this issue as fixed in 10.3.1, but I still see the wrong result for Mean[{<|"a" -> 1, "b" -> 2|>}] in that release but not in 10.2 or earlier (using Windows 7 x64).
Jan
12
comment Get the last line from each of a large number of files, transform them, and write all results to a single new file
@alancalvitti I am not aware of any higher-level functionality for such variable-length record extraction in stream-based fashion. Perhaps Leonid's new (as yet unofficial) streaming extensions would be useful when implementing such a thing?
Jan
7
comment Append fixed value to random selection of list
I don't know your full context, but if you are using f := ..., then I'd probably recommend that you use f[] := ... instead. This is a matter to style rather than necessity. I'd be suprised, for example, if {f, f} returned a list with different elements. But getting different elements from {f[], f[]} is unsurprising. Again, this is just a question of convention rather than a language requirement. You might also consider something like f[n_] := RandomChoice[fns][n].
Jan
7
comment Append fixed value to random selection of list
The Cases expression transforms each element of the Hold expression into a function. It is at that point that each list variable gets notionally moved out of the Hold and into a Function. A function definition is also a held context, so the list variable is still not evaluated. It is only when the function is called that the list variable finally appears in a context in which it is evaluated.
Jan
4
comment Using Merge[Identity] and Transpose on a Dataset
Up to v10.3, the data type information is used primarily for formatting the graphical representation of a Dataset or for performing a small number of proactive sanity checks upon a query. I have speculated that future releases may use the type information for data and/or algorithm optimization. I discuss the use of type information more fully in (87479), (89081) and (102696).
Jan
3
comment How to make CounterIncrement step in increments of 2
@Kuba Yes, the same CounterFunction must be used at all levels (a surprise to me). I have updated my answer to reflect that. Thanks.
Dec
25
comment How to use `Shortest` for pattern matching?
duplicate of (72283).
Dec
23
comment A subtlety in Query
@halirutan The Query documentation says: Unless an operator is specifically recognized to be descending, it is assumed to be ascending. The descending operators are explicitly listed in the documentation. Apply is not on that list. Some ascending operators are discussed explicitly in the documentation, but usually because they behave differently as query operators than they do when used as normal functions.
Dec
15
comment File-name completion for custom functions
@Athanassios Yes, the method in (78935) enables autocompletion for option arguments, whereas the method here using specialArgFunctions.tr enables autocompletion for regular (non-option) arguments.
Dec
14
comment File-name completion for custom functions
@Athanassios specialArgFunctions.tr shows an example for a function with a hard-coded list of acceptable values for the first argument: "MyPlanetInfo"->{{"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Uranus", "Neptune"}}
Nov
24
comment Run Command Not Executing Node
I tried a number of experiments using various other applications in place of Mathematica or node, and all of them worked. Only the Mathematica/node combination failed. The fact that the "synch" work-around is effective offers some sort of clue, but I'm stumped as to what it means. I spent a few minutes in PROCMON trying to spot something unusual, but to no avail. Most interestingly, using the command line version of the Mathematica kernel works -- only the notebook interface fails.
Nov
17
comment With “named row” nested Datasets: How to Select or Filter rows by row key with criteria from another Dataset?
@Edmund No, I would use the method if it fills your needs. My question may be rhetorical but it is genuine (as is my praise). I am only musing upon the subtle changes in Query behaviour that we have seen with each 10.x release to date. I'm hopeful that such changes are becoming less frequent.
Nov
17
comment With “named row” nested Datasets: How to Select or Filter rows by row key with criteria from another Dataset?
+1 Wow, a tip o' the hat for jamming so much cleverness into a single query. Kudos for figuring out that Dataset["x"]@Dataset[<|"x" -> <|"a" -> 1|>, "y" -> <|"a" -> 2|>|>], will cause the inner expressions like <|"a"->1|> to be treated as plain data instead of as operators. But also using this to flip the query/data relationship: mind-blowing. I wonder how stable such subtle behaviour will be between releases?
Nov
16
comment Run Command Not Executing Node
This is a known problem with nodejs on Windows. As a work-around, try writing synchronously to file descriptor 1: Import["!node.exe -e require('fs').writeSync(1,'test')", "Text"].
Nov
16
comment Run Command Not Executing Node
I can reproduce this problem in Version 10.3 on Win7/x64.
Nov
12
comment Can't inject EncryptedObject
I added a workaround section, with thanks to @SimonWoods.
Nov
11
comment Understanding Part and Span operating on expressions with heads that are not List
similar: (2449), (95763).