Whats wrong with this version of functor(Prolog)? -
I tried to write the factor in Prol. This is my version:
lenlist (L, N): - Lynch list (L, 0, N). Lenlist ([], n, n). Lenlist ([_ | T], P, N): - P1P1, Linistist (T, P1, N). Functor1 (Term, F, N): - Term = .. [F | ARGES], Linist (Erg, N).
Here is a sample execution of the Prologue Inbuilt Factor
? - Brain (period, f, 6).
Now I get an exception if I execute the same query with functor1
? - Fun 1 (period, F, 6). Error: = .. / 2: Arguments are not necessarily immediate exceptions: (8) _G180 = .. [F | _G 248]? << Code> << code>
I have written the
problem It is not that Args has started for now .. .. Try inserting the Linist / 3 before that.
BTW, you can also use built in length / 2.
Comments
Post a Comment