# Why this list has a length of 1?

Here is the code :

bb = HoldForm[{aa[1], bbb[2], cc[3], dd[4]}]


it returns :

{aa[1], bbb[2], cc[3], dd[4]}


Which is what I expect.

But when I do :

Length[bb]


It returns

1


Why ?? Why doesn't it return 4?

The aa, bbb, cc, dd are functions that I want to keep in an unevaluated form.

• try Length[bb[[1]]] to get 4. Check Head[bb] and FullForm[bb] to see why you are getting 1. – kglr Jul 9 '17 at 18:14
• The head is a HoldForm and indeed, Length[bb[[1]]=4. But why in the result the HoldForm disappears ? – StarBucK Jul 9 '17 at 18:18
• Strabuck, that's what HoldForm does. HoldForm >> Details: HoldForm allows you to see the output form of an expression without evaluating the expression. – kglr Jul 9 '17 at 18:21
• @kglr I edited my message. If I understand it is just a matter of visualisation ? If I want to "really" unevaluate the things inside because I want to keep it in a "factorised" form before sending it to a function it will not work ? – StarBucK Jul 9 '17 at 18:30
• Starbuck, perhaps, Inactivate is what you need. – kglr Jul 9 '17 at 18:47

Regarding "The aa, bbb,cc,dd are functions that I want to keep in an unevaluated form":

If you have version 10 or a newer version, Inactivate is useful for this purpose:

aa = # + 1 &;
bbb = #^2 &;
bb2 = Inactivate[{aa[1], bbb[2], cc[3], dd[4]}]


Length @ bb2


4

TreeForm @ bb2


bb2[[2]]


bb2[[2]]//Activate


4

• Yeaaah exactly what I wanted to do. Thanks a lot ! – StarBucK Jul 10 '17 at 11:23

The expression bb has only one leaf, a List:

bb = HoldForm[{aa[1], bbb[2], cc[3], dd[4]}];

bb // TreeForm


If you want to hold separate elements that will be individually manipulated perhaps:

newbb = Thread[bb];

newbb // TreeForm


The Length of newbb is 4.

Possibly of interest: