[mercury-users] mixing function rules and predicate rules

Mike Burrell public+lceliw at wizardlike.ca
Fri Oct 1 01:29:21 AEST 2010


On 10-09-30 11:16 AM, Julien Fischer wrote:
> 
> Hi,
> 
> On Thu, 30 Sep 2010, Mike Burrell wrote:
> 
>> This might be a silly question, but is there a way to use predicates
>> within a function or vice versa? E.g., let's say p1 and p2 are
>> predicates and f is a function. I'd like to do something like:
>>
>> f(X) = A ++ B where p1(X, Z, A), p2(Z, B).
> 
> 	f(X) = A ++ B :-
> 		p1(X, Z, A),
> 		p2(Z, B).
> 
> is probably what you are after.

Thank you! That's the magic I was looking for :)

Cheers,
Mike
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list