Re: HANG ON!
From: Bill Spight (bspight_at_pacXbell.net)
Date: Sun, 14 Nov 2004 15:25:49 GMT
> > split_in_half([A,B|List],[A|First],[B|Second]).
> > split(List,First,Second,Third,Fourth) :-
> > split_in_half(List,FirstHalf,SecondHalf),
> > split_in_half(FirstHalf,First,Second),
> > split_in_half(SecondHalf,Third,Fourth).
> Well done! :-)
> But look at split_in_half/3. What if the first list is empty? What if it
> has only one member? You need to define the predicate for those cases,
> And what about split/5 with those cases?
Too early in the morning.
split_in_half([A,B|List], [A|First], [B|Second]).
tells us about the first two elements in the original list. What about
the rest of the list (the tail)? You need to show the relationship among
List, First, and Second, too.