mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-11 03:45:33 +00:00
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
48 lines
1.2 KiB
Mathematica
48 lines
1.2 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% The "imperative-solve.power" Benchmark
|
|
% Part of the DPPD Library.
|
|
%
|
|
% The program to be specialised is a solver for a small imperative
|
|
% language which uses environments to store values for variables. The
|
|
% program contains built-ins and negations. The task is to specialise a
|
|
% sub-program calculating the power (X^Y) for a known power and base but
|
|
% an unknown environment.
|
|
|
|
:- module imperative_solve_power.
|
|
|
|
:- interface.
|
|
|
|
:- pred imperative_solve_power is semidet.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module assoc_list.
|
|
:- import_module imperative_solve_impl.
|
|
:- import_module list.
|
|
:- import_module pair.
|
|
:- import_module run.
|
|
|
|
imperative_solve_power :-
|
|
power_2_5([], Eout1),
|
|
use(Eout1),
|
|
power_2_5(["z" - 1, "y" - 3], Eout2),
|
|
use(Eout2).
|
|
|
|
% The partial deduction query
|
|
%
|
|
% :- power(2, 5, Ein, Eout).
|
|
%
|
|
% The run-time queries
|
|
%
|
|
% :- power(2, 5, [], Eout).
|
|
% :- power(2, 5, [z/1, y/3], Eout).
|
|
%
|
|
% Example solution
|
|
%
|
|
% to be inserted
|
|
%
|
|
% Michael Leuschel / K.U. Leuven / michael@cs.kuleuven.ac.be
|