mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
tests/debugger/list_cmd.m:
tests/debugger/list_cmd.inp:
tests/debugger/list_cmd.exp:
tests/debugger/list_cmd.exp2:
Add new test case.
tests/debugger/list_cmd.sh:
Add script to be set as the 'list_cmd'.
tests/debugger/Mmakefile:
Enable the new test.
37 lines
757 B
Mathematica
37 lines
757 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% The .exp file is for platforms with posix_spawn.
|
|
% The .exp2 file is for platforms without posix_spawn.
|
|
%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module list_cmd.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
|
|
main(!IO) :-
|
|
fib(5, N),
|
|
io.write_int(N, !IO),
|
|
io.nl(!IO).
|
|
|
|
:- pred fib(int::in, int::out) is det.
|
|
|
|
fib(N, F) :-
|
|
( if N < 2 then
|
|
F = 1
|
|
else
|
|
fib(N - 1, F1),
|
|
fib(N - 2, F2),
|
|
F = F1 + F2
|
|
).
|