:- module( _, [perm/2], [assertions , regtypes , basicmodes , nativeprops] ).

perm([[num(int(A))]],[num(int(-1))]) :-
        A<0 .
perm([[num(int(A))]],[num(int(1))]) :-
        A>=0,
        A=<0 .
perm([[num(int(A))]],[B]) :-
        A>=0,
        A>0,
        C is 1*A,
        D is A+ -1,
        execute_notrace_1(D,C,_1,_2,_3,_4,_5,B,_6) .

execute_notrace_1(A,B,[],_1,_2,_3,_4,num(int(B)),[]) :-
        A=<0 .
execute_notrace_1(A,B,C,D,E,F,G,H,I) :-
        A>0,
        J is B*A,
        K is A+ -1,
        execute_notrace_1(K,J,C,D,E,F,G,H,I) .


