このディレクトリの索引
% list_nth/4 append/3(member/2)の変形

list_nth(N,L0,[A|R],L) :-
        integer(N),
        N > 0,
        M is N - 1,
        length(L0,M),
        append(L0,[A|R],L).
list_nth(N,L0,[A|R],L) :-
        integer(N),
        N < 0,
        N1 is N + 1,
        N2 is abs(N1),
        length(R,N2),
        append(L0,[A|R],L).
list_nth(N,L0,[A|R],L) :-
        var(N),
        append(L0,[A|R],L),
        length(L0,N1),
        N is N + 1.