Finding if a list is within another list

From: briandela (briandela_at_hotmail.com)
Date: 03/30/04

  • Next message: Laurence Darby: "Re: Parallel prolog"
    Date: 30 Mar 2004 09:39:08 -0800
    
    

    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.


  • Next message: Laurence Darby: "Re: Parallel prolog"