prefix([], n) = [] prefix(L, 0) = [] prefix(h:t, n) = h:prefix(t, n-1) (when n > 0)Converting to C++ yields the following definition of prefix.
List prefix(const List L, int n) { if(n == 0 || isEmpty(L)) { return emptyList; } else { return cons(head(L), prefix(tail(L), n-1)); } }