11
$\begingroup$

I'm about to report this as a bug but wondered what you would make of it. Works as expected in version 7.

Union@Map[DeleteCases[#, False] &, ConstantArray[{1}, 99]]

{{1}}

Union@Map[DeleteCases[#, False] &, ConstantArray[{1}, 100]]

{{}}

$\endgroup$
  • 2
    $\begingroup$ Very interesting. It is seems related to Map autocompiling as TracePrint with TraceInternal-True suggests. $\endgroup$ – LLlAMnYP Feb 21 '18 at 18:42
  • 2
    $\begingroup$ I believe there are "compilation thresholds" which trigger at certain values, i.e. 99 to 100. I think there's an option to control the value it triggers at, but I always forget it. In any event, I think the output of the second is a bug, introduced at this "compilation threshold". $\endgroup$ – user6014 Feb 21 '18 at 20:00
  • 3
    $\begingroup$ Definitely due to the compiling but must be a bug: SetSystemOptions["CompileOptions" -> {"MapCompileLength" -> 110}] $\endgroup$ – Mike Honeychurch Feb 21 '18 at 21:42
  • 1
    $\begingroup$ This bug has been reported to Wolfram support. $\endgroup$ – Chris Degnen Feb 22 '18 at 8:48
  • 1
    $\begingroup$ @ChrisDegnen of course Evaluate forces the correct result, but it is correct only by accident, since now it will not delete any False entries.. Evaluate@DeleteCase[#,False]& evaluates to #& $\endgroup$ – LLlAMnYP Feb 22 '18 at 11:04
4
$\begingroup$

This bug has been fixed in the recently released version 12.0.

Union@Map[DeleteCases[#, False] &, ConstantArray[{1}, 100]]             
(* {{1}} *)
$\endgroup$

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.