[mercury-users] DCG in higher-order terms

Robert Bossy bossy at ccr.jussieu.fr
Thu Oct 7 00:39:11 AEST 1999


Hello,

I can't figure out how to write a lambda expression that uses DCG
notation.

Here is the code (that compiles and works fine) that I don't wanted to
write:

write_list(L,"\n",(pred(S::in,IO0::di,IO::uo) is det :- (print("here is:
",IO0,IO1), print(S,IO1,IO)))).

% reminder from io library:
% :- pred io__write_list(list(T), string, pred(T, io__state, io__state),
io__state, io__state).
% :- mode io__write_list(in, in, pred(in, di, uo) is det, di, uo) is
det.



Here is what I tried:

write_list(L,"\n",(pred(S::in) is det --> (print("here is: "),
print(S)))).


That notation seemed correct to me but the compiler complains about not
knowing '-->'.
Is the notation incorrect or the the compiler can't undersatand DCG in
closures?

Thanks,
RB

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list