Skip to first unread message

PickyMcCritical

unread,
Feb 10, 2017, 12:09:18 AM2/10/17
to swi-p...@googlegroups.com
Can someone explain swi-prolog capabilities and included predicates?/libraries? to a super Prolog beginner?


I just made a hobby of Prolog and casually went though the 12 chapters of LPN.org to get me up to speed. Now I'm trying to read up on the swi-prolog resource manual to start my own personal project, and I have no idea what the fuck they're talking about on a single page. The clarity of details is vastly better on LPN.org; it's as if the resource manual was written only for people who already know 99% of what's going on with this software. Please help. I don't even know what the debugger is. I have "trace." and then "notrace, nodebug." imbedded into my muscle memory for finding problems. I totally skip this "debug" features that pops up automatically. I have sooo much to learn and I can't even get started.

I just want to understand all the preloaded predicates in detail. I'd also like some information on how to process image files using Prolog :( I'd think this is beginner stuff, right?

Anne Ogborn

unread,
Feb 11, 2017, 11:29:18 PM2/11/17
to PickyMcCritical, SWI-Prolog
Howdy Picky -


You're not alone. If you're coming from another language, Prolog's endlessly baffling for a while.
You have to expect a bit of learning curve going from a Cessna to a rocket plane.
Well, yes, the library docs, like most docs, assume you have a basic grasp of the language. So yes, it's written for people who know 99% of what's going on and only need that particular 1% explained.

And it's an especially deep dive for Prolog, given how nifty Prolog is.

Questions like 'how do I start the debugger?' can be answered with

http://www.pathwayslms.com/swipltuts/student/index.html

Hanging out on ##prolog on freenode.net IRC is a good way to get quick answers to those 'hey, it seems stuck' type messages.

There's no native image processing library. Shelling out to imagemagick or using the FFI
(foreign function interface) to bind to OpenCV C++ or using JPL and Java OpenCV bindings are reasonable options.

If you're going to be programming in Prolog I recommend getting 3 books.

Programming in Prolog with the ISO standard, by Clocksin and Mellish
The Art of Prolog, Leon Sperling
The Craft of Prolog, Richard O'Keefe

And if you want a 4th, I'd say 'The Practice of Prolog' and/or Ivan Bratko's book.

So, read LPN and/or Clocksin/Mellish, and figure out basics (yay, you've done that!)
Spend a while fiddling with SWI-Prolog and poking around in the website.
Read Art of Prolog to beef up your theory muscles.
Read the 7.0 release notes. Read the section on modules on the website.
Read
http://www.pathwayslms.com/swipltuts/html/index.html if you want debogglized about the web framework, a good way to transition from toy programs to real software. (bias warning, I'm the author).
Prowl through the 'Add-Ons' link on website looking at various nifty packs
read some of the other tutorials on same website.


There's really too many libraries to explain them all. And they vary from the mundane and practical (SSL libraries) to the exotic (probablistic logic programming, which is nifty but boggling) and in between (the XPATH library is actually very cool).

Re the debugger - as a beginner, using the graphical debugger can often be more rewarding.
To start it query

tspy(my_pred).

on your predicate of interest, and it'll pop up a graphic debugger. More details in the FAQ document above.

PickyMcCritical

unread,
Feb 11, 2017, 11:57:54 PM2/11/17
to SWI-Prolog, pickymc...@gmail.com, anni...@yahoo.com
Wow what a thorough answer. Thanks very much for all the info and resources! Not surprisingly, it looks like I've got a lot of work ahead of me. This is my first programming language, too, so rather than Cessna>rocket plane, I'm more going from a bicycle lol. Better get to it...

Anne Ogborn

unread,
Feb 12, 2017, 12:30:03 AM2/12/17
to PickyMcCritical, SWI-Prolog
Well, you're incredibly lucky then!

Our experience is that programming in what we call 'procedural' languages can ruin you for ever programming in a logic language. Learning on a logic language first will be something that you'll
enjoy forever.

But yes, learning to program is like playing an instrument. You can learn the basics fairly quickly,
but it takes a lifetime to really become master of the art.

Anne Ogborn

unread,
Feb 12, 2017, 12:32:46 AM2/12/17
to Anne Ogborn, PickyMcCritical, SWI-Prolog
And definitely, visit us on ##prolog.

If you've never used an IRC program, it's an (old) chat system like yahoo messenger.

https://webchat.freenode.net/

put some nickname in the nick, put ##prolog in the channel
leave 'auth to services' unchecked, promise nto to be a robot.

Bunch of people having fun in there right now.

Ronerycoder

unread,
Feb 12, 2017, 8:01:37 AM2/12/17
to SWI-Prolog, pickymc...@gmail.com, anni...@yahoo.com

Our experience is that programming in what we call 'procedural' languages can ruin you for ever programming in a logic language. Learning on a logic language first will be something that you'll
enjoy forever.


I would like to say that I picked up Prolog "again" (having seen it briefly at Uni as a mandatory item; I wanted to attended the WAM course but that was cancelled due lack of interest. Still, I read most of the first edition of "The Art of Prolog") by reading "The Reasoned Schemer" (https://mitpress.mit.edu/books/reasoned-schemer). That book illiustrates Prolog-style logic programming using examples expressed in Lisp/Scheme syntax (i.e. an embedding of Prolog in Lisp is assumed. This is what is called "Kanren" I think. So you are supposed to know Lisp, at least the basics).

It's a thin book, but one needs to allocate a month to go through it in any case. Afterwards one knows nothing about Prolog syntax but one actually knows what the logic engine is meant to do.

Also: Someone not happy with Clocksin/Mellish during a talk: https://youtu.be/Zja3PHcWI-s?t=5090

Derek G Jones

unread,
Feb 12, 2017, 8:31:44 AM2/12/17
to Ronerycoder, SWI-Prolog, pickymc...@gmail.com, anni...@yahoo.com
Can I please ask that we do not blaspheme in this mailing list. I don't want to unsubscribe, but this is a first in my recollection and I'd like to ask that it be a last.

Thanks.

Regards

Derek Jones.



From: Ronerycoder <roner...@gluino.name>
To: SWI-Prolog <swi-p...@googlegroups.com>
Cc: pickymc...@gmail.com; anni...@yahoo.com
Sent: Sunday, February 12, 2017 8:01 AM
Subject: Re: [SWIPL] Holy Sweet Jesus I'm Confused

--
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+...@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.


Ronerycoder

unread,
Feb 12, 2017, 12:18:30 PM2/12/17
to SWI-Prolog, roner...@gluino.name, pickymc...@gmail.com, anni...@yahoo.com, scu...@yahoo.com

> blasphemy

Mentioning LISP will result in a Fatwa?

Samer Abdallah

unread,
Feb 13, 2017, 4:53:38 AM2/13/17
to Ronerycoder, SWI-Prolog
On 12 Feb 2017, at 17:18, Ronerycoder <roner...@gluino.name> wrote:


> blasphemy

Mentioning LISP will result in a Fatwa?
There is only One True Declarative Language.
signature.asc
Reply all
Reply to author
Forward
0 new messages