The predicate mylength/3has the following problem. I assume that you want to run it using mode mylength(+,-,-). Just then if the first argument is not canceled.
- , [H1|T1]
, , /2.
, [T1copy]
.
,
, H1copy.
Prolog.
Bye
P.S.: , - ,
.
H1copy.
, , SWI-Prolog,
,
SWI-Prolog . ^ C g
:
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.1.16)
Copyright (c) 1990-2014 University of Amsterdam, VU Amsterdam
Action (h for help) ? goals
[552,959] mylength([1, 2, 3], [[]], _G40)
[552,958] mylength('<garbage_collected>', '<garbage_collected>', _G40)
[552,957] mylength('<garbage_collected>', '<garbage_collected>', _G40)
[552,956] mylength('<garbage_collected>', '<garbage_collected>', _G40)
[552,955] mylength('<garbage_collected>', '<garbage_collected>', _G40)
, ,
Prolog
552959, ..
!
SWI-Prolog: ERROR: Out of local stack.