I have and expression a + b + c - d and I would like to generate a list of {a, +, b, +, c, -, d}. I have tried Head, FullForm which is close but not quite what I am looking for. I have also tried Part and Extract with no luck.

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Aug 11 '15 at 12:39
  • $\begingroup$ It's not clear exactly what output you want. This is close: First@ToBoxes[a + b + c - d, StandardForm], but all parts are strings. Is that what you want? $\endgroup$ – Michael E2 Aug 11 '15 at 12:41
  • 2
    $\begingroup$ I don't fully understand your question. + is not part of that expression. What FullForm shows you corresponds directly to how the expression is stored internally. It might help if you explained your motivation behind trying to do this. $\endgroup$ – Szabolcs Aug 11 '15 at 12:45
  • 1
    $\begingroup$ If you don't want strings then a + b + c - d /. Plus -> List gives {a, b, c, -d} $\endgroup$ – Bob Hanlon Aug 11 '15 at 13:11
  • 4
    $\begingroup$ It might help if you explain why you want to do this as well. $\endgroup$ – Ymareth Aug 11 '15 at 13:21

I'm certain that this will not be the solution to whatever real problem there is behind your question, but incidentally, you could use this function from a former answer

fultzTokenize[t_String] := 
   FrontEnd`UndocumentedTestFEParserPacket[t, False]], _String, 


it gives you

Mathematica graphics

but be aware that output and input are strings.

|improve this answer|||||
  • $\begingroup$ I can not resist and give you a fultzPoint, +1. $\endgroup$ – user9660 Aug 11 '15 at 17:31

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