9
$\begingroup$

Bug introduced in 10.0.2 and fixed in 10.2.0


Since 10.0.2 some code that previously worked using named slots fail in very particular circumstances.

Attchd screenshot shows the issue w/ a particular Dataset which involves multiple pre-processing steps to construct, so cannot display here.

Lookup using form #name& fails, while the more normal forms or in Key form work.

enter image description here

However, it's difficult to reproduce this issue in a minimal example. When I try to project out a few rows and columns from this table to copy-paste it as text, subsequent re-casting to Dataset works w/ all forms of Slot.

Can anyone reproduce?

$\endgroup$
2
  • $\begingroup$ Well, I haven't been able to reproduce this so far. I'd like to remark that you can drop the double quotes in the last slot form. $\endgroup$ Commented Dec 11, 2014 at 22:09
  • $\begingroup$ What's the Dataset`GetType of byVisit? My debugging process for these things would be to do Normal[Query[All,#KinectSyncTime&]] to get the compiled query, then do compiledquery ** type to see what the type inference thinks (it will yield a FailureType judging by the error you saw). $\endgroup$ Commented Dec 11, 2014 at 23:11

1 Answer 1

7
$\begingroup$

Following discussion w/ Jason Grigsby at WRI, rather than edit the Q w/ additional detail, the conclusion is that composite Keys such as lists of strings, interfere with above-mentioned named slot access:

data = <|"a" -> 1, {"b", "c"} -> 2|> // Dataset;

data[#["a"] &]

1

while

data[#"a" &]
Failure[Function, 
Association[
 "MessageTemplate" :> MessageName[Function, "slot1"], 
  "MessageParameters" -> {"a", Slot["a"]& , 
TypeSystem`SkeletonForm[
TypeSystem`Assoc[TypeSystem`AnyType, 
TypeSystem`Atom[Integer], 2]]}]]
$\endgroup$
3
  • $\begingroup$ This is now fixed. Thanks for reporting! $\endgroup$ Commented Jul 2, 2015 at 7:38
  • $\begingroup$ @TaliesinBeynon Can you confirm, that #"boing" is officially supported as alternative to #["boing"]? I ask because I need to review some things for named slots in the IntelliJ plugin anyway and I would like to support it completely. The documentation for Slot doesn't even mention the #"name" form. $\endgroup$
    – halirutan
    Commented Jul 23, 2015 at 1:12
  • $\begingroup$ @halirutan if you look at FullForm[#"boing"] you'll see it is exactly the same as #boing -- they parse to the same thing. For some reason #"boing" is not documented. I've reported that as a bug. $\endgroup$ Commented Jul 23, 2015 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.