5
$\begingroup$

This expression (explained here by Leonid) evaluates fine unless Evaluation->Debugger is enabled:

h[x : (_Integer) : 1] := x

Syntax::sntxf: "x:" cannot be followed by "(_Integer):1".
Syntax::tsntxi: "(_Integer):1" is incomplete; more input is needed.
Syntax::sntxi: Incomplete expression; more input is needed .

Strangely it works if the parentheses are removed:

h[x : _Integer : 1] := x

But both of these fail when debugging:

h[x : (_Integer | None) : None] := x
h[x : Alternatives[_Integer, None] : None] := x

(* Workaround: *)
ptn = _Integer | None;
h[x : ptn : None] := x

All this was with Mathematica 8.0.4 Linux

What is the debugger up to?

$\endgroup$
  • 2
    $\begingroup$ Seems to work OK in Mma 9.0 $\endgroup$ – Dr. belisarius Nov 7 '13 at 0:14
  • $\begingroup$ The obligatory question: what version are you running? $\endgroup$ – rcollyer Nov 7 '13 at 14:48
  • $\begingroup$ @rcollyer "All this was with Mathematica 8.0.4 Linux" :) $\endgroup$ – ssch Nov 7 '13 at 14:49
  • $\begingroup$ Yeah, yeah. I should read the whole thing before I comment. I know, I know. :P $\endgroup$ – rcollyer Nov 7 '13 at 14:49

Your Answer

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

Browse other questions tagged or ask your own question.