Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.