Incorrect. What if A and B are both NULL? Then this function computes head(A), which causes a memory fault.
Type error. The first parameter of cons is required to be an integer. But tail(A) is a list.