[mercury-users] abstract types.

Ralph Becket rbeck at microsoft.com
Tue Jan 18 21:04:38 AEDT 2000


> There's a bit of a problem in making bidirectional functions 
> like this -
> apart from anything else, the code for \/ing the bits together doesn't
> work in the backwards mode (ie:
> 	lr1item(ProdNum, Dot, Sym) = Bits :-
> 		encode_sym(Sym, SymNum),
> 		Bits = (ProdNum << 20) \/ (Dot << 12) \/ SymNum.
> )
> 
> Now, you can work around this by using the C interface as a layer
> between the layers of Mercury - implement the two modes as 
> pragma c_code
> that calls two separate mercury preds/funcs that each 
> implement a single
> mode. This seems expensive and ugly. Perhaps it's time to 
> allow separate
> implementations of different modes of a pred/func?

I agree that a facility for the latter would be useful.
However, is it necessary for your code to use the same
predicate for packing and unpacking?

Cheers,

Ralph
--------------------------------------------------------------------------
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