append

BAP Online Manuals : Library Reference : Library by Name : append
Previous: alloc_server
Next: asserta

6.2.8. append

appends on list to another

SYNOPSIS

INCLUDE 'prolib'
append(List1,List2,ResultList)

SYNTAX

 append(List1,List2,ResultList) (i,i,o) (i,o,i) (o,i,i) (o,o,i)

ARGUMENTS

voidlist(List1) (x) first list of any type
voidlist(List2) (x) second list of any type
voidlist(Result) (x) combined list of the first and second lists elements

DESCRIPTION

Succeeds if the arguments can be match so that ResultList is the concatenation of List1 and List2.
Its definition is:

PREDICATE append(voidlist,voidlist,voidlist).
append([],X,X).
append([H|T],List,[H|Sum]):-
	append(T,List,Sum).

EXAMPLE

append(L1,L2,X),
	write(L1,L2),nl,
	fail.

ERRORS

fails if arguments cannot be matched. No runtime errors

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

remove , member


BAP Online Manuals : Library Reference : Library by Name : append
Previous: alloc_server
Next: asserta