ECLiPSe provides a number of different tools and libraries to assist the programmer with program development:
In addition, ECLiPSe provides several tools that aid in the understanding of a programs runtime behaviour:
This section focuses on the program development libraries and two complementary runtime analysis tools, the profiler and the coverage library. Throughout this chapter, the use of each of the tools is demonstrated on the following n-queens code:
:- module(queen). :- export queen/2. queen(Data, Out) :- qperm(Data, Out), safe(Out). qperm([], []). qperm([X|Y], [U|V]) :- qdelete(U, X, Y, Z), qperm(Z, V). qdelete(A, A, L, L). qdelete(X, A, [H|T], [A|R]) :- qdelete(X, H, T, R). safe([]). safe([N|L]) :- nodiag(L, N, 1), safe(L). nodiag([], _, _). nodiag([N|L], B, D) :- D =\= N - B, D =\= B - N, D1 is D + 1, nodiag(L, B, D1).