How to check which items on the list meet certain condition?
问题 How to make a function called busLineLonger, which receives at least two parameters to decide if a bus line is longer or not? */This is how it works*/ * busStops(number_of_the_bus,number_of_stops)*/ /*?- busLineLonger([busStops(1,7),busStops(2,4),busStops(3,6)],5,WHICH). * WHICH = [1,3]. Using only comparative things, like @> <@ /==@. Sorry my english Edit... So far I've think of something like this busLineLonger([busStops(A,B)|R],N,[_|_]):- N@>B, busLineLonger(R,N,A). 回答1: Here's how you