


![[top]](top.gif)
Synopsis:
length C -- the length of a chain complex.
The length of a chain complex is defined to be the difference between the smallest and largest indices of spots occupied by modules, even if those modules happen to be zero.
Code:
-- ../../../Macaulay2/m2/chaincomplexes.m2:44-47
length ChainComplex := (C) -> (
s := select(spots complete C, i -> C_i != 0);
if #s === 0 then 0 else max s - min s
)



![[top]](top.gif)