setof in prolog

prolog中setof的源代码是什么?
?- listing(setof).
:- meta_predicate setof(?,0,-).

setof(A, B, F) :-
    free_variable_set(A, B, D, C),
    (   C==v
    ->  findall(A, D, E),
        E\==[],
        sort(E, F)
    ;   findall(C-A, D, E),
        (   ground(E)
        ->  sort(E, G),
        pick(G, C, F)
        ;   bind_bagof_keys(E, _),
        sort(E, G),
        pick(G, C, H),
        sort(H, F)
        )
    ).

true.
相关文章
相关标签/搜索