Write a predicate prefixes(L,M)
that, given a list L = [X1, X2, ... , Xn],
calculates a list M of all of the prefixes of L: [[X1,..., Xn], [X1, ... , Xn−1], ... , [X1, X2], [X1], [ ]]
Example
?- prefixes([],M). M = [[]].
?- prefixes([1,2],M) M = [[1,2],[1],[]]
?- prefixes([1,1,1],M). M = [[1,1,1],[1,1],[1],[]]
```