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.

Maybe this is a bug or maybe Infix acts differently than the other functions.

The fact is that both:

TreeForm[Infix[f[x, a]]]

and

ToString[Infix[f[x, a]]]

crash the kernel. I use Mathematica 9.0 and maybe there are other cases that Infix behaves strangely.

Does anybody can explain why this happens ?

share|improve this question
1  
confirmed (9.000). –  george2079 Dec 4 '13 at 19:08
    
I confirm this behavior for Mathematica 8.0.4 under Windows 7 x64. –  Alexey Popkov Dec 5 '13 at 7:06
add comment

1 Answer

Hack workaround..

infix[f_] := Infix[f, "~" <> SymbolName[Head[f]] <> "~"];
ToString[infix[f[a, b, c]]]

-> "a~f~b~f~c"
share|improve this answer
    
Nice hack to get the String , but the TreeForm seems awkward. I am parsing some mma expressions and I would like to use the embedded functions as they are. So I am still puzzled... I would like to know the real reason why Infix fails above. –  tchronis Dec 4 '13 at 19:43
    
Also ToString[ Hold@(Infix[f[x, a], "~" <> SymbolName[Head[f[x, a]]] <> "~"]) ] crashes the kernel. Removing Hold or replacing with HoldAll works ok ... –  tchronis Dec 4 '13 at 20:05
3  
note this also crashes: OutputForm[Infix[f[a, b]]] -- seems like a question for Wolfram support. –  george2079 Dec 4 '13 at 20:07
1  
Sent to Wolfram support. I will update here when they send a feedback. Thanks @george2079 –  tchronis Dec 5 '13 at 6:05
add comment

Your Answer

 
discard

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

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