Prefix of a list (source code)

= Prefix of a list

= List prefix
{synonym}

= Prefixes of a list
{synonym}

An initial segment of a <list>, including the empty segment and, for finite lists, the whole list. A proper prefix excludes the whole list. Fully materialising all prefixes of a length-$n$ list needs $\Theta(n^2)$ element constructors, although the outer list of prefixes has only $n+1$ entries.