[mercury-users] Assert/Retract
Daniel Elenius
elenius at csl.sri.com
Sat Jan 28 03:44:52 AEDT 2006
Ian MacLarty wrote:
> On 27 Jan 2006, at 06:48, Ralph Becket wrote:
>
>> Daniel Elenius, Thursday, 26 January 2006:
>>> No, because *new* policies can be loaded at runtime. New code has to be
>>> loaded into the mercury or prolog engine, and I don't want to have to
>>> reload all the policies whenever a new one comes in.
>>
>> I'm assuming then you don't know all the policies ahead of time, and
>> therefore you can't just load them all at startup.
>>
>> In that case you could use the code in extras/dynamic_linking which
>> provides a Mercury interface to the C dlopen(), dlsym(), and dlclose()
>> functions. Of course, you'd have to make sure your policy modules
>> were compiled before you dl.open'ed them.
>>
>> There may be other solutions, but I don't know enough about your
>> application to suggest any with confidence.
>>
>
> May I suggest an alternative you may want to think about: Define a
> new type to describe your policies, then write Mercury code to process
> values of this type. You may find that customising the representation
> of the policies in this way allows you to control the rules that are
> allowed in policies and may also allows you to add rules that would
> otherwise be difficult to add if the policy was a prolog (or mercury)
> module. You also then have more control of how the policies are
> interpretted which may mean they can be interpretted more efficiently.
>
This kind of goes into the question: Should I use Mercury "reasoning"
directly, or use Mercury as an implementation language to implement the
reasoner. I was thinking of doing the former, as it would (I assume) be
much less work. The policies map pretty well to at least Prolog, and I
was hoping that that would mean that they map just as well to Mercury
(or better -- we also have a type system that seems to be mostly
subsumed by the Mercury type system).
> If your policies must be logic programs, then you might want to have a
> look at samples/interpretter which is a simple interpretter for
> definite logic programs.
>
Might be worth looking at. Thanks.
> Ian.
>
> --------------------------------------------------------------------------
>
> 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
> --------------------------------------------------------------------------
>
--------------------------------------------------------------------------
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