[mercury-users] Translating from Prolog
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Jun 11 10:46:06 AEST 2004
On 10-Jun-2004, hanberg at ruc.dk <hanberg at ruc.dk> wrote:
> I hope it went well at the contest!
>
> I'm still not on track, so if you would help me to a working example I will be
> more than greatfull since I have used quite a bit of time that I don't really
> have on it.
>
> I'm trying this:
>
> :- type &(A, B) ---> A & B.
> :- type ~(A) ---> ~(A).
You need "&" and "~" to be constructors for the same type.
So I think you want instead something like this:
:- type expr ---> atomic_expr(...)
; (expr & expr)
; ~(expr).
with some appropriate stuff in the "..." part.
Or alternatively, use parametric polymorphism:
:- type expr(T) ---> atomic_expr(T)
; (expr(T) & expr(T))
; ~(expr(T)).
> :- pred closes(_).
That should be
:- pred closes(expr).
or
:- pred closes(expr(T)).
depending on which solution you chose from the above.
--
Fergus Henderson | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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