Files
mercury/tests/hard_coded/func_and_pred.m
Fergus Henderson d6102ac497 Add a test case for functions and predicates with the same name
Estimated hours taken: 0.25

tests/hard_coded:
	Add a test case for functions and predicates with the same name
	whose arity differs by only one.
1996-10-24 06:11:46 +00:00

37 lines
912 B
Mathematica

%----------------------------------------------------------------------------
% Small test of functions and predicates that have the same name.
%----------------------------------------------------------------------------
:- module func_and_pred.
:- interface.
:- import_module list, io.
:- func concat(list(X), list(X)) = list(X).
:- mode concat(in, in) = out is det.
:- pred concat(list(X), list(X), list(X)).
:- mode concat(in, in, out) is det.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module string.
concat([], L) = L.
concat([E|R], L) = [E|concat(R,L)].
concat([], L, L).
concat([E|R], L, [E|Z]) :-
concat(R,L,Z).
main -->
{ concat(['H','e'],['l','l','o',' '], Hello) },
{ World = concat(['w','o'],['r','l','d','!','\n']) },
{ string__from_char_list(concat(Hello, World), HelloWorld) },
io__write_string(HelloWorld).
%-----------------------------