using predicates from packs

24 views
Skip to first unread message

piotr

unread,
Jul 27, 2017, 7:48:09 PM7/27/17
to SWI-Prolog
Hello

I have installed a pack for swi-prolog, namely logtalk. How can I use predicates that are included in the pack, like date/4. Here are Prolog outputs for my queries:

-----

?- pack_info(logtalk).
Package:                logtalk
Title:                  Logtalk - Object-Oriented Logic Programming Language
Installed version:      3.11.1
Installed in directory: c:/users/pracownik/appdata/roaming/swi-prolog/pack/logtalk
Author:                 Paulo Moura <pmo...@logtalk.org>
Maintainer:             Paulo Moura <pmo...@logtalk.org>
Packager:               Paulo Moura <pmo...@logtalk.org>
Home page:              http://logtalk.org/
Download URL:           http://logtalk.org/files/swi-prolog/packs/logtalk-3.11.1.tgz
true.
-------

?- date(X,2017,2,3).
ERROR: Undefined procedure: date/4 (DWIM could not correct goal)

-----

Best

Piotr

Paulo Moura

unread,
Jul 27, 2017, 8:02:16 PM7/27/17
to piotr, SWI-Prolog
Hi Piotr,

A side note. The Logtalk pack is mainly meant for *deployment*, not *development*. Note that you can download Logtalk installers for several operating-systems from the Logtalk website. If you run one of those installers, the installation will not conflict with thew pack.
I assume you are referring to:

http://logtalk.org/library/iso8601_0.html

First, you need to load that library. Try:

?- {iso8601(loader)}.
...
% (0 warnings)
true.

?- iso8601::date(X,2017,2,3).
X = 2457788.

Cheers,
Paulo

-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:pmo...@logtalk.org>
Web: <http://logtalk.org/>
-----------------------------------------------------------------




piotr

unread,
Jul 28, 2017, 5:01:48 AM7/28/17
to SWI-Prolog, kul...@kul.pl
Hi Paulo

Thanks a lot for your swift reply!

Indeed I am interested in iso8601 library. However the response is as follows. (I do not have much experience with libraries so I may miss something obvious, but I cannot find in the documentation a clear explanation how to deal with them...) 

----
?- {iso8601(loader)}.
ERROR: Undefined procedure: {}/1 (DWIM could not correct goal)
----

Carlo Capelli

unread,
Jul 28, 2017, 5:18:06 AM7/28/17
to piotr, SWI-Prolog
Hi Piotr

maybe you should start Logtalk itself ...

?- use_module(library(logtalk)).
true.

?- {iso8601(loader)}.
% [ /home/carlo/lib/swipl/pack/logtalk/logtalk-3.11.1/library/termp.lgt loaded ]
...


--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.

piotr

unread,
Jul 28, 2017, 5:35:29 AM7/28/17
to SWI-Prolog, kul...@kul.pl
That was it! It is working now. Thanks!

Piotr
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.

Paulo Moura

unread,
Jul 28, 2017, 5:58:11 AM7/28/17
to piotr, SWI-Prolog
Hi,

> On 28 Jul 2017, at 10:01, piotr <kul...@kul.pl> wrote:
>
> Hi Paulo
>
> Thanks a lot for your swift reply!
>
> Indeed I am interested in iso8601 library. However the response is as follows. (I do not have much experience with libraries so I may miss something obvious, but I cannot find in the documentation a clear explanation how to deal with them...)

You need to load the pack first:

?- use_module(library(logtalk)).

If you use instead one of the Logtalk installer, you can in alternative just run "swilgt" instead of "swipl".

Cheers,
Paulo

P.S. For a quick tutorial in Logtalk, see:

https://learnxinyminutes.com/docs/logtalk/

piotr

unread,
Jul 28, 2017, 6:19:12 AM7/28/17
to SWI-Prolog, kul...@kul.pl
Thaks once again! I will refer to the tutorial now...

Best

Piotr
Reply all
Reply to author
Forward
0 new messages