Re: HANG ON!
From: Bill Spight (bspight_at_pacXbell.net)
Date: 11/14/04
- Previous message: Bill Spight: "Re: HANG ON!"
- In reply to: Bill Spight: "Re: HANG ON!"
- Next in thread: George Sp.: "Re: HANG ON!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 14 Nov 2004 15:25:49 GMT
Dear miniquinny,
I wrote:
> > 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,
> too.
>
> And what about split/5 with those cases?
>
> Best,
>
> Bill
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.
Best,
Bill
- Previous message: Bill Spight: "Re: HANG ON!"
- In reply to: Bill Spight: "Re: HANG ON!"
- Next in thread: George Sp.: "Re: HANG ON!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|