Files
mercury/tests/dppd/match_impl.m
Peter Ross 51497341cc Add the DPPD (dozens of problems in partial deduction) suite to the
Estimated hours taken: 0.1

Add the DPPD (dozens of problems in partial deduction) suite to the
tests directory.
1999-02-20 11:34:42 +00:00

28 lines
514 B
Mathematica

:- module match_impl.
:- interface.
:- import_module char.
:- pred match_aab(list(char)::in) is semidet.
:- import_module list.
:- implementation.
match_aab(Str) :- match([a,a,b], Str).
:- pred match(list(char)::in, list(char)::in) is semidet.
match(Pat,T) :- match1(Pat,T,Pat,T).
:- pred match1(list(char)::in, list(char)::in, list(char)::in,
list(char)::in) is semidet.
match1([],_Ts,_P,_T).
match1([A|Ps],[B|Ts],P,[X|T]) :-
( A = B ->
match1(Ps, Ts, P, T)
;
match1(P, Ts, P, [X|T])
).