length_of([], 0).
length_of([_|T], L):- length_of(T, TailLength),
L = TailLength + 1.
. , length_of [_,|T] , ` T . , .
goal: length_of([1,2,3], L),
, ' T [2,3]. - T. , , TailLength 2, 1 ' L 3.
, [2,3] length_of([2,3], TailLength. , ' - [3] T. , [3], 1, 1, [2,3], 2. . length_of , [3]. [3] [ ], T ' [], , [], 1, [3]. . ֳ length_of([], Tail Length , ' TailLength 0. 1 , [3] . , , 1, [2,3] , ; 1, [1,2,3].
8.1 . , , , , .
length-of([1,2,3],L1)
length-of([2,3],L2)
length-of([3],L3)
length-of([],0)
L3 = 0 + 1 = 1
L2 = L3+ 1 = 2
L1 = L2+ 1 = 3
.8.1. .
8.2.3. .
, length_of . - ? , .
length_ of , , . . .
- , , .
- , .
- , 0 . ' .
.
Domains
list = integer*
Predicates
Length_of(list, integer, integer)