fix lists predicates

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2141 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2008-03-12 17:05:04 +00:00
parent c07c5286c0
commit fda34985b9
3 changed files with 23 additions and 22 deletions

View File

@ -138,7 +138,4 @@ phrase(Phrase, S0, S) :-
'$t_body'(Phrase, _, last, S0, S, Goal), !,
'$execute'(Goal).
lists:append([], L, L) .
lists:append([H|T], L, [H|R]) :-
lists:append(T, L, R).

View File

@ -77,6 +77,29 @@ otherwise.
:- dynamic prolog:'$user_defined_flag'/2.
lists:append([], L, L).
lists:append([H|T], L, [H|R]) :-
lists:append(T, L, R).
% member(?Element, ?Set)
% is true when Set is a list, and Element occurs in it. It may be used
% to test for an element or to enumerate all the elements by backtracking.
% Indeed, it may be used to generate the Set!
lists:memberchk(X,[X|_]) :- !.
lists:memberchk(X,[_|L]) :-
lists:memberchk(X,L).
% memberchk(+Element, +Set)
% means the same thing, but may only be used to test whether a known
% Element occurs in a known Set. In return for this limited use, it
% is more efficient when it is applicable.
lists:member(X,[X|_]) :- !.
lists:member(X,[_|L]) :-
lists:member(X,L).
:- ['protect.yap'].
version(yap,[5,1]).

View File

@ -469,25 +469,6 @@ current_module(Mod,TFN) :-
source_module(Mod) :-
'$current_module'(Mod).
% member(?Element, ?Set)
% is true when Set is a list, and Element occurs in it. It may be used
% to test for an element or to enumerate all the elements by backtracking.
% Indeed, it may be used to generate the Set!
lists:memberchk(X,[X|_]) :- !.
lists:memberchk(X,[_|L]) :-
lists:memberchk(X,L).
% memberchk(+Element, +Set)
% means the same thing, but may only be used to test whether a known
% Element occurs in a known Set. In return for this limited use, it
% is more efficient when it is applicable.
lists:member(X,[X|_]) :- !.
lists:member(X,[_|L]) :-
lists:member(X,L).
% comma has its own problems.
:- '$install_meta_predicate'((:,:), prolog).