Given a list of the format,
[item(a), item(b), item(c), other(d), other(e) ...]
where the number of items isn't fixed, nor is the number of others, but items always precede other, how do I split the list so that I can pass the items and the others into different predicates.
I've been trying to find ways to split the list based on the elements but can't figure out a way to do so.
I need to write a predicate that will take this list, and then pass the items to an itemPredicate, and the others to an otherPredicate.
If there's any other info I can provide please let me know.
A simple split predicate that separates
item(_)fromother(_)could work as follows:And use it like this:
It doesn't even require that
items always precedeothers.