For in range

Taking Jan’s advice; never used these before.

first_8_2(Conference,Teams) :-
    aggregate_all(bag(Team),(limit(8,team(Conference,Team))),Teams).
?- first_8_2(east,Teams).
Teams = [bucks, raptors, philadelphia, celtics, pacers, nets, magic, pistons].
2 Likes