I can't seem to wrap my head around how this works, to be specific I don't understand how F1 represents the value of (N-1)! cause the way I see it once we reach the base case the value of F1 stays at 1 seeing as to how it is never reassigned. I just want to understand for instance if N = 4, how once we reach the base case the value of F1 goes from 1 to 2 to 6.
factorial(0,1). factorial(N,F) :- N>0, N1 is N-1, factorial(N1,F1), F is N * F1.
gtrace- swi-prolog.org/pldoc/man?section=debugger