DOMAINS
nlist=real*
nllist=nlist*
clist=char*
cllist=clist*
slist=string*
sllist=slist*
symlist=symbol*
symllist=symlist*
PREDICATES
lconcat(nlist, nlist, nlist)
lconcat(nllist, nllist, nllist)
lconcat(clist, clist, clist)
lconcat(cllist, cllist, cllist)
lconcat(slist, slist, slist)
lconcat(sllist, sllist, sllist)
lconcat(symlist, symlist, symlist)
lconcat(symllist, symllist, symllist)
lcount(nlist, real)
lcount(slist, real)
lcount(clist, real)
lcount(symlist, real)
lcount(nllist, real)
lcount(sllist, real)
lcount(cllist, real)
lsum(nlist, real)
%lsum(nlist, real, real)
GOAL
lcount([1, 1, 1, 1], X), write("X:"), write(X), nl,
lcount(["1", "1", "1", "1", "1"], Y), write("Y:"), write(Y), nl,
lcount([unu, unu, unu, unu, unu, unu], Z), write("Z:"), write(Z), nl,
lcount(['1', '1', '1'], T), write("T:"), write(T), nl,
lcount([[1, 1],[],[1],[2],[3],[4] ], V), write("V:"), write(V), nl,
lcount([[],[],[],[],[],[] ], W), write("W:"), write(W), nl,
lcount([[3],[2]], A), write("A:"), write(A), nl,
lsum([1, 2, 3, 4, 5, 6], B), write("B:"), write(B), nl,
lconcat([1, 2, 3],[4, 5, 6], C), write("C:"), write(C), nl,
lconcat([1, 2, 3], D, [1, 2, 3, 4, 5]), write("D:"), write(D), nl,
lconcat([1, 2],[E, F],[1, 2, 8, 9]), write("E:"), write(E), write("; F:"), write(F), nl,
lconcat(G, [3, 4],[1, 2, 3, 4]), write("G:"), write(G), nl,
findall(H, lconcat(H, _, [1, 2, 3]), HH), write("HH:"), write(HH), nl,
findall(I, lconcat(_, I, [1, 2, 3]), II), write("II:"), write(II), nl,
lconcat([[1],[2]], J, [[1],[2],[3],[4]]), write("J:"), write(J), nl.
CLAUSES
lcount([], 0):-!.
lcount([_|Tail], Rez):-lcount(Tail, Rez1), Rez=Rez1+1, !.
%lcount([[]|Tail], Rez):-lcount(Tail, Rez1), Rez=Rez1+1, !.
%lconcat([], L, L):-!.
lconcat([H|Tail], List2, [H|TailRez]):-lconcat(Tail, List2, TailRez).
lconcat([], L, L).
lsum([X], X):-!.
lsum([H|Tail], Rez):-lsum(Tail, Rez1), Rez=Rez1+H.