Fwd: How can I make scope in prolog?
He-chien Tsai <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CABCDVh2e--XcBDChBY20YB-yH1EcrNGbq+CrkfAGWmQeT43Z0g@mail.gmail.com> |
That's quite interesting. Thanks for help. 2014/1/13 Paulo Moura <[email protected]> > > On 13/01/2014, at 14:10, He-chien Tsai <[email protected]> wrote: > > > Yes, I found that is what I actually need. Thanks for your answer. > > Logtalk looks interesting, I don't know logtalk before. but it has > several backends which makes me confused. > > Yes, Logtalk is highly portable. > > > Is it possible to use a backend-specified feature in logtalk? > > Yes. In fact, it'a quite common for Logtalk applications to take advantage > of backend-specific features (e.g. libraries, constraints, tabling, Unicode > support). Some of the provided examples illustrates that kind of usage. > > > What would happen if I use a backend-specified feature and run it on > another backend without that feature? > > That would depend if equivalent functionality exists on the other backend > of if it can be emulated. If true, it's usually simple to isolate the > different implementations in a set of objects implementing a common > protocol (interface). > > Cheers, > > Paulo > > > 2014/1/13 Paulo Moura <[email protected]> > > > > On 13/01/2014, at 12:22, He-chien Tsai <[email protected]> wrote: > > > > > I want to scope the scope which prolog inference engine is restricted > in > > > that scope. > > > > > > for example: > > > > > > > > > pred1(A) :- pred2(A). % rule 1 > > > > > > scope(scope1). > > > % In this scope, rule 1 is deprecated > > > pred2(A) :- pred3(A). % rule 2 > > > pred3(b). % rule 3 > > > > > > pred2(A). % A = b. > > > pred1(A). % no. > > > > > > end_scope(scope1). > > > > Not sure I fully understand your question but SWI-Prolog module system > and Logtalk object system allows you to define define a scope for a set of > predicates using modules or objects. > > > > Cheers, > > > > Paulo > > > > ----------------------------------------------------------------- > > Paulo Moura > > Logtalk developer > > > > Email: <mailto:[email protected]> > > Web: <http://logtalk.org/> > > ----------------------------------------------------------------- > > > > > > > > > > _______________________________________________ > > SWI-Prolog mailing list > > [email protected] > > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > > > > ----------------------------------------------------------------- > Paulo Moura > Logtalk developer > > Email: <mailto:[email protected]> > Web: <http://logtalk.org/> > ----------------------------------------------------------------- > > > > > -------------- next part -------------- HTML attachment scrubbed and removed