element = i(integer); c(char); s(string)
listE = element*
:
[ i(15), s(""), c('A'), s(""), c('+'), s(""), i(48), c('!') ]
: , :
- ([ ]) ;
- [H|T] , H ( , ), T , .
H , T . " | " , , () .
, . , , , , . , [1, 2, 3] 1 , [2, 3] , .. [1, 2, 3] = [ 1 | [2, 3] ].
[1,2 | [3] ]. , , : [1, 2, 3 | [] ].
, , , ,
. , , .. .
, , , , , .
length([ ], 0). /* */
length([_|T], L): length(T, L_T), L = L_T + 1.
/* L_T - */
/* L - . */
:
Goal: length([1,2,3], X).
readterm(< >, ). write(),
1. .
Domains
list=integer*
Goal
write(" "), readterm(list,X), nl,
write(" L = "), write(X), nl.
2: .
Domains
list=integer*
Predicates
Readlist(list)
Goal
write(" "), readlist(L),nl,
write(" L = ",L).