I don't understand why your function takes 2 arguments when it's going to rearrange one list.
Your t
case is almost correct, but you've practically turned it inside out - it should be
(cons (car x) (Func1 (cdr x)))
That is, a list where the car
is the same as in the input, and the cdr
is the result of flattening the cdr
of the input.
The listp
case looks like it's suffering from a similar form of "inside-out-ness".
Apart from the inexplicable y
you have all the right bits but in the wrong order, except that it needs two Func1
calls - one for the car
and one for the cdr
.
I'll leave the rearrangement of the bits in that case as an exercise.