Re: predutils package available (Re: PAC library for develop version available)
Kuniaki Mukai <[email protected]> Fri, 3 Oct 2014 14:15:53 +0900
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Hi Richard, On Oct 3, 2014, at 12:24, Richard A. O'Keefe <[email protected]> wrote: > 'use_module' comes from Quintus Prolog. > The way it was intended to be used was > > :- use_module(Module_Name, [ > Imported_Predicate_1/Arity_1, > ..., > Imported_Predicate_n/Arity_n > ]). > > It was considered to be important for software maintenance > that you should explicitly list all the predicates you > needed from the module. Having done this, the imported > predicates are then available *without* requiring any prefix. > > This is like the way you do > > from fractions import Fraction > > in Python, after which you use fractions.Fraction as just > plain Fraction. > > This is dual to the way that a :- module directive lists > all the things *exported* from a module. > > The idea was that *all* the stuff relating to modules > (:- module, :- use_module, :- meta_predicate) should be > at the very top of a file, and the rest of the file > should as much as possible look as though modules did > not exist. Interesting. Thank you for fresh historical information and original idea on module system of Quintus Prolog. One question. I want to put meta_predicate directive close at the definition like this. :- meta_predicate my_flip(2, ?, ?). my_flip(F, X, Y):- call(F, Y, X). (Though I am not sure whether the directive is necessary in this particular case). Is this a bad practice ? Or are you saying on `header information` for use of external predicates, which sounds reasonable principle. Kuniaki > > > _______________________________________________ > SWI-Prolog mailing list > [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 496 bytes Desc: Message signed with OpenPGP using GPGMail URL: <https://lists.iai.uni-bonn.de/pipermail/swi-prolog/attachments/20141003/91fc2200/signature.asc>