Cross product with rules

From: Simon (sorrynomail_at_no.no)
Date: 11/15/03

  • Next message: Bill Spight: "Re: Cross product with rules"
    Date: Sat, 15 Nov 2003 01:29:49 +0000 (UTC)
    
    

    Hi All,

    So now I want to add rules to my cross products. Lets assume we have a set
    of enumerated items...

    item(0,'iA').
    item(1,'iB').
    item(2,'iC').
    item(3,'iD').
    item(4,'iE').
    item(5,'iF').

    How would i go about creating all valid lists of these items which conform
    to the rules...

    a) Any ordered subset.
    e.g:
     ['iB']
     ['iA','iD','iE']
     ['iC','iF']
     ['iA','iB','iC','iD','iE','iF']

    b) Any continuous ordered subset.
    e.g:
     ['iB']
     ['iC','iD','iE']
     ['iE','iF']
     ['iA','iB','iC','iD','iE','iF']

    c) Any fixed relation, such as 2 items spaced by 2.
    e.g.
     ['iA','iD']
     ['iC','iF']

    Thanks for the help so far.
    Simon ;o)

    (+ can anyone recommend a good prolog book?)


  • Next message: Bill Spight: "Re: Cross product with rules"