mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
Estimated hours taken: 2.5
Distinguish between predicates and functions in the declarative debugger.
browser/declarative_execution.m:
Add a pred_or_func field to trace_atom.
trace/mercury_trace_declarative.c:
Construct trace atoms with the extra field.
browser/declarative_user.m:
Print function call results using function syntax.
browser/debugger_interface.m:
browser/util.m:
Move the definition of type pred_or_func to util.m, so it can
be used by the declarative debugger as well as the external debugger.
runtime/mercury_stack_layout.h:
Update a reference to the location of type pred_or_func.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/func_call.{m,inp,exp}:
Test case for the new feature.
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
Update expected output from tests.
24 lines
292 B
Mathematica
24 lines
292 B
Mathematica
:- module func_call.
|
|
:- interface.
|
|
:- import_module io.
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
:- implementation.
|
|
:- import_module int.
|
|
|
|
main -->
|
|
io__write_int(fib(6)),
|
|
io__nl.
|
|
|
|
:- func fib(int) = int.
|
|
|
|
fib(N) =
|
|
(
|
|
N =< 1
|
|
->
|
|
1
|
|
;
|
|
fib(N - 1) +
|
|
fib(N - 3) % Oops.
|
|
).
|
|
|