8 lines
99 B
Perl
8 lines
99 B
Perl
|
fac(1,1):- !.
|
||
|
fac(X,F):-
|
||
|
X > 1,
|
||
|
Y is X - 1,
|
||
|
fac( Y, Next ),
|
||
|
F is X * Next.
|
||
|
|
||
|
% ?- fac(3, X).
|