This file is indexed.

/usr/share/doc/cadabra/algorithms/length.tex is in cadabra 1.39-0.2ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\cdbalgorithm{length}{}

Replaces the expression with its length, that is, the number of terms
in a sum, the number of factors in a product or the number of
elements in a list.
\begin{screen}{1,2,4,5,7,8}
lst:= {a,b,c,d}:
@length(%);
lst:= 4;
sum:= a + b + c + d + e:
@length(%);
sum:= 5;
prod:= a*b*c:
@length(%);
prod:= 3;
\end{screen}
Note that the original expression gets replaced; if you need a new
expression use a square-bracket construction as in
\begin{screen}{1,2}
sum:= a + b + c + d;
@length[@(sum)];
2:= 4;
\end{screen}

Here is a more complicated example which takes all terms except the
first and last from an expression:
\begin{screen}{1,2}
a+b+c+d+e+f+g;
@take(%){ 1..@collect_terms[@length[@(%)]-2] };
b+c+d+e+f;
\end{screen}
(remember that counting terms starts from zero).

If you just want to display the number of elements, use
\subscommand{number\_of\_terms}; this is an output command and does
not change the expression.

\cdbseealgo{number_of_terms}
\cdbseealgo{take_match}