Re: Sum of terms --> list

*To*: mathgroup at smc.vnet.net*Subject*: [mg110687] Re: Sum of terms --> list*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Fri, 2 Jul 2010 02:56:41 -0400 (EDT)

On 7/1/10 at 8:27 AM, nma at 12000.org (Nasser M. Abbasi) wrote: >it seems in the second case, this happens becuase the >expression was evaluated first? By holding evaluation, one can >get the same result as in the first case: >List @@ (a + b*I) >{a, I*b} >List @@ (3 + 4*I) >3 + 4*I >ReleaseHold@(List @@ (3 + Hold@4*I)) >{3,4 I} Not quite the right explanation. The key is 3 + 4 I isn't an expression in the same sense as 3.4 isn't an expression. That is it has no parts. It makes no more sense to have List@@(3+4 I) yield {3, 4 I} then it does to have List@@{3.4} yield either {3.4} or {3, 4}. By adding Hold, you create a new expression which has parts. Now you can use Apply to change this to a list and rid yourself of the Hold part using ReleaseHold.