Re: Finding if a list is within another list
From: Nick Wedd (nick_at_maproom.co.uk)
Date: 04/01/04
- Previous message: Arnaud Gotlieb: "Poster deadline for ICLP'04"
- Next in thread: Matthew Huntbach: "Re: Finding if a list is within another list"
- Reply: Matthew Huntbach: "Re: Finding if a list is within another list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 1 Apr 2004 09:47:14 +0100
In message <3505c493.0403300939.16d7ab46@posting.google.com>, briandela
<briandela@hotmail.com> writes
>Hi All,
>
>I'm looking for some prolog code to determine if a list, e.g. [1,1] is
>inside another list.... That's just a simple sublist... but what I
>want to do is something like this.
>
>Say I have a list [7,4,2,3,1,1,4,5,6,7] ... I want to be able to
>say... give me a list between 2 and 5 and then see if [1,1] is in
>that.
>
>I need to get the list that starts with, say 2 and ends with say 5,
>and then do a sublist on that.
>
>so the predicate would be something like GetList([start], [stop],
>[originalList], X).
>
>Any help would be appreciated.
You need to write two sub-predicates. The first will look for a sublist
with specified initial and final elements. The second will look for
sublists within this.
Nick
-- Nick Wedd
- Previous message: Arnaud Gotlieb: "Poster deadline for ICLP'04"
- Next in thread: Matthew Huntbach: "Re: Finding if a list is within another list"
- Reply: Matthew Huntbach: "Re: Finding if a list is within another list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]