Skip to content

select/3 documentation inaccurate #3165

@dcnorris

Description

@dcnorris

Documentation header for select/3 currently states,

select(X, Xs0, Xs1)
Succeeds when the list Xs1 is the list Xs0 without the item X

But this is inaccurate, since Rem is not entirely "without 1" in this example:

?- select(1, [1,2,3,2,1], Rem).
   Rem = [2,3,2,1]
;  Rem = [1,2,3,2]
;  false.

For ease of reference, current definition is:

%% select(X, Xs0, Xs1).
%
% Succeeds when the list Xs1 is the list Xs0 without the item X
%
% ```
% ?- select(c, "abcd", X).
%    X = "abd"
% ;  false.
% ```
select(X, [X|Xs], Xs).
select(X, [Y|Xs], [Y|Ys]) :- select(X, Xs, Ys).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions