BAP Online Manuals : Library Reference : Library by Name : remove
Previous: rem_handle
Next: removewindow

6.2.109. remove

removes an element from a list

SYNOPSIS

INCLUDE 'prolib'
remove(3,[1,2,3,4],List)

SYNTAX

remove(Elem,OldList,NewList) (i,i,o)

ARGUMENTS

void(Elem) (x) term to be removed from OldList
voidlist(OldList) (i) list to be modified.
voidlist(NewList) (i) OldList without Elem.

DESCRIPTION

Remove() returns OldList without its the member Elem.
Its definition is:

PREDICATE remove(void,voidlist,voidlist).
remove(X,[X|New],New):- !.
remove(X,[A|Old],[A|New]):-
	remove(X,Old,New).   /*  X!=A !! */

EXAMPLE

read(X),
remove(X,[1,2,3,4,5],Y),
write(Y),nl.

ERRORS

No runtime errors

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

append , member


BAP Online Manuals : Library Reference : Library by Name : remove
Previous: rem_handle
Next: removewindow