delete/3
This commit is contained in:
parent
c428e2256d
commit
cdad87a6fc
@ -3,9 +3,7 @@
|
|||||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||||
* @date Thu Nov 19 09:54:00 2015
|
* @date Thu Nov 19 09:54:00 2015
|
||||||
*
|
*
|
||||||
* @brief core list operations
|
* @addtogroup lists
|
||||||
*
|
|
||||||
* @ingroup lists
|
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -73,7 +71,7 @@ lists:append([H|T], L, [H|R]) :-
|
|||||||
lists:append(T, L, R).
|
lists:append(T, L, R).
|
||||||
|
|
||||||
|
|
||||||
:- set_prolog_flag(source, false). % :- no_source.
|
:- set_prolog_flag(source, true). % :- no_source.
|
||||||
|
|
||||||
% lists:delete(List, Elem, Residue)
|
% lists:delete(List, Elem, Residue)
|
||||||
% is true when List is a list, in which Elem may or may not occur, and
|
% is true when List is a list, in which Elem may or may not occur, and
|
||||||
@ -90,7 +88,7 @@ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
|||||||
*/
|
*/
|
||||||
lists:delete([], _, []).
|
lists:delete([], _, []).
|
||||||
lists:delete([Head|List], Elem, Residue) :-
|
lists:delete([Head|List], Elem, Residue) :-
|
||||||
Head == Elem, !,
|
Head = Elem,
|
||||||
lists:delete(List, Elem, Residue).
|
lists:delete(List, Elem, Residue).
|
||||||
lists:delete([Head|List], Elem, [Head|Residue]) :-
|
lists:delete([Head|List], Elem, [Head|Residue]) :-
|
||||||
lists:delete(List, Elem, Residue).
|
lists:delete(List, Elem, Residue).
|
||||||
|
Reference in New Issue
Block a user