users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is that possible to call dynamic function in the C interface?


From: emacstheviking
Subject: Re: Is that possible to call dynamic function in the C interface?
Date: Tue, 26 Nov 2013 21:50:16 +0000

Hi Dave,

Without having seen the source code my interpretation would be that Pl_Query_Call() would search the database and, irrespective of how a predicate/rule/fact arrived there, if it finds it, it will call it. Why would it not find a dynamic predicate? That wouldn't be very useful I don't think and, with what knowledge of gprolog internals I do have, having written some things myself, I'd be surprised if it didn't work with dynamic predicates.

The only way to find out though is to actually do it I guess, I don't have the time nor the inclination today!

Is your question really "How do I find out what predicates have been dynamically created?" in which case you would have to call current_predicate/0...here is part of the help text, I bolded the bit you might want to see!

current_predicate(Pred) succeeds if there exists a predicate indicator of a defined procedure that unifies with Pred. All user defined procedures are found, whether static or dynamic. Internal system procedures whose name begins with ’$’ are not found.

Hope that helps.
:)
Sean.



On 26 November 2013 21:24, daveti <address@hidden> wrote:
Hi there,

Dave is back again - with a weird question:)
Say we have a dynamic function in the pl file:
:- dynamic(parent/2).
Then there are some bindings too...
parent(bob,mary).
parent(mary,john).
In GProlog, asserta(parent(daveti,john)). will add a new binding. So, how
could I make it using the C interface?
It looks like to me query function is not designed for calling dynamic
function....Or am I wrong?
int Pl_Query_Call(int func, int arity, PlTerm *arg_adr);

Thanks,
Dave



--
View this message in context: http://gnu-prolog.996310.n3.nabble.com/Is-that-possible-to-call-dynamic-function-in-the-C-interface-tp1177.html
Sent from the Users mailing list archive at Nabble.com.

_______________________________________________
Users-prolog mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/users-prolog


reply via email to

[Prev in Thread] Current Thread [Next in Thread]