List Subsets
Simon
sorrynomail at no.no
Tue Nov 18 17:15:25 EST 2003
Hi,
I'm hoping you could show me examples of how a functional/declarative
language could be used to consicely describe resticted subsets of elements.
I'm looking for a 'specification' style definition so any ideas/input would
be very welcome.
Thanks for your time,
Simon.
--
Say I have a list of items which is considered ordered...
['iA', 'iB', 'iC', 'iD', 'iE', 'iF']
(
which could also be enumerated if needed...
[(0,'iA'), (1,'iB'), (2,'iC'), (3,'iD'), (4,'iE'), (5,'iF')]
)
How would I go about writing definitions such that I could calculate...
a) All ordered subsets.
e.g:
['iB']
['iA','iD','iE']
['iC','iF']
['iA','iB','iC','iD','iE','iF']
b) All continuous ordered subset.
e.g:
['iB']
['iC','iD','iE']
['iE','iF']
['iA','iB','iC','iD','iE','iF']
c) All fixed relations, such as 2 items spaced by 2.
e.g.
['iA','iD']
['iC','iF']
More information about the Python-list
mailing list