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

emacstheviking <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <CAEiEuUJPBpResiqcZmEY=KhZ0d+5jbz_8nx-GKwmn-yGN8AdQA@mail.gmail.com>
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 <[email protected]> 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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/users-prolog
>

_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.