6
$\begingroup$

Bug introduced in 10.0 and fixed in 11.0.0


With

Hold[Dataset[Random[]]]

enter image description here

instead of an expected

Hold[Dataset[Random[]]]

Can Dataset expressions be held?

$\endgroup$
  • $\begingroup$ Related mathematica.stackexchange.com/questions/78131/… and Dataset upvalues but I wasn't able to customize. $\endgroup$ – Ronald Monson Jul 15 '15 at 2:17
  • $\begingroup$ Current use case is generating some documentation that uses held WL commands but can imagine future needs requiring the passing around of Held Datasets as per the holding of all other WL expressions. $\endgroup$ – Ronald Monson Jul 15 '15 at 2:46
  • 4
    $\begingroup$ Hold stops evaluation, but not typesetting (FormatValues). $\endgroup$ – ilian Jul 15 '15 at 2:49
  • $\begingroup$ @ilian in terms of evaluation ls = {}; held = Hold@Dataset[AppendTo[ls, Random[]]]; SetAttributes[f, HoldAll]; f[x_] := x; f@held produces three random numbers instead of one random number? in terms of an appearance as a WL command, is there a way of outputting Dataset[{assocs}], verbatim - initial attempts at redefining Dataset output via Format as suggested proved unsuccessful and also seems like overkill ... $\endgroup$ – Ronald Monson Jul 15 '15 at 3:41
  • 1
    $\begingroup$ Yes, it looks like there is an evaluation leak in the typesetting. Note that FullForm[f @ held] is as expected. Would perhaps something like Inactivate[Dataset[{Random[], Random[]}], Random] work? $\endgroup$ – ilian Jul 15 '15 at 4:13
7
$\begingroup$

This question is related to:

My proposed solution:

mk : MakeBoxes[(Hold | HoldForm | HoldComplete | HoldPattern)[__], _] := 
 Block[{$hldDataset = True, Dataset}, mk] /; ! TrueQ[$hldDataset]

Now:

Hold[Dataset[Random[]]]
Hold[Dataset[Random[]]]

Unlike the case of Graphics I consider the default formatting behavior pathological here.

$\endgroup$
  • $\begingroup$ Very neat. Thanks. Did the trick and helps improve said documentation. $\endgroup$ – Ronald Monson Jul 15 '15 at 6:54
  • 3
    $\begingroup$ Yes, definitely a bug, which has since been fixed. $\endgroup$ – Itai Seggev Apr 22 '17 at 0:19
  • $\begingroup$ @ItaiSeggev Thank you. Do you know the specific version in which the bug was corrected? $\endgroup$ – Mr.Wizard Apr 22 '17 at 0:23
  • 3
    $\begingroup$ Fixed in 11.0.0. See also (89036). $\endgroup$ – ilian Apr 22 '17 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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