BAP Online Manuals : Library Reference : Library by Name : conlist
Previous: concat
Next: consult

6.2.27. conlist

joins several strings

SYNOPSIS

INCLUDE 'prolib.h'
conlist([Str1,Str2,StrN],ResultStr)

SYNTAX

conlist( Strings,ResultStr)(i,x)

ARGUMENTS

stringlist(Strings) (i) A list of strings to be joined
string(ResultStr) (x) A string built by the ones of Strings

DESCRIPTION

Joins several strings to one. Each element of stringlist must be bound to a string.
Its definition is:

PREDICATE conlist(stringlist,string).
conlist([],""):-!.
conlist([Str],Str):-!.
conlist([Str1,Str2],Res):-
	concat(Str1,Str2,Res),!.
conlist([H|T],Res):-
	conlist(T,Temp),
	concat(H,Temp,Res).

EXAMPLE

conlist(["Hello"," World","!\n"),
write(X).

ERRORS

A runtime error occurs if the arguments are bound to something other than strings.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

concat


BAP Online Manuals : Library Reference : Library by Name : conlist
Previous: concat
Next: consult