Six ways to iterate in Prolog

Don’t forget that The Craft of Prolog was written 30 years ago. It’s stood up pretty well.

Anyway, a couple of reasons why people like me keep on recommending it:

  • because it goes into deep design issues
  • because Richard O’Keefe is an awesome software designer and programmer

(I once took over a project that Richard started. Almost every other project that I’ve taken over has been an awful experience, usually requiring a painful “do I repair or rewrite this” decision … with Richard’s code I started with “wow, what a great design” and “this is better code that I would have written” … and making changes was easy. If I have trouble understanding something in The Craft of Prolog I assume that the problem is with me, not with Richard.)

5 Likes

I’d like to (since I regularly update stuff and am still learning how on the swish site), but there doesn’t seem to and editing option on my original post.

The most current link is https://swish.swi-prolog.org/p/Iteration1.swinb

Appologies if that came across as a criticism of either you or the book. I’ve just had a lot “Tis written in the ancient scriptures, so you can’t argue…” in my life recently (unrelated to my Prolog hobby), which gets my hackles up since I like to think of myself as a scientist/engineer type, not a cultist.

Thanks Paul. I’ve submitted it to https://prologhub.pl/ for moderation, but not sure if it worked (I find all these different CMS systems a bit of a nightmare).

Thanks Joe, it’s an external blog post with a link to SWISH rather than a blog post, I can remake it as such but then it would be my name on it and I’d rather it were yours!

I’ve added a link to this discussion, saving the latest version as https://swish.swi-prolog.org/p/Iteration2.swinb

Hi Paul

I just keep on getting an error message when I submit it for moderation with no clue what I’ve done wrong, so maybe its easiest for you to put up.

As someone who has spent most of his life working for newspapers, I know few people read bylines anyway. BTW, there’s a typo of my name which I don’t know how to fix on the site. It should be Robert Laing, not Robert Liang.

Ok, I’ll get onto fixing/debugging, see what that error might be.

Fixed the typo (sorry, that was me), published the post (thank you!), still need to track down where the “submit for moderation” bug is…

Please do.

1 Like

As far as I understand SWISH, updating involves creating a new URL, which makes it a bit tricky to make edits. Ideally, I’d like to keep the same URL, but that doesn’t seem possible.

That sounds like a question that everyone might want to know including me. I will post it as a new question. Thanks.

No. Just use File/Save, add a comment and use the Update Program button at the bottom. If you are logged in you can restrict who can save. Some problems with this have been reported. If it doesn’t work report the name and time you tried to save.

1 Like

Thanks Jan. Just fixed a few typos in my graph traversing tutorial and that worked perfectly. Maybe that I wasn’t making notes before caused the confusion.

@joeblog

In case you haven’t noticed I have been deleting my non-relevant replies along the way. It is a habit I picked up from StackOverflow in that others who read this for the first time get tiered of reading replies that aren’t directly related to the topic. In this case these post have been more of a side discussion about adding a link and as such don’t belong in this topic.

The reason I am noting this for you is that you might want to also delete your replies related to the replies I deleted as they now make it look like you are having a conversation with the other part missing. :smiley:

Then I need to know what you deleted … Feel free to remove such replies, at least from me. I’m not sure whether we should aim at SO quality answers or replies or merely discussion that indeed may not be very relevant after the dust has settled.

1 Like

Sorry. That was meant for joeblog. I didn’t add an @ because he was the original OP and AFAIK should get the notification by default. Also when I reply to a specific person or statement I try to use the quote feature.

Thanks for letting me know I can clean up such replies or yours; don’t plan on it as you rarely to never go off topic…

My opinion on that is no, leave that to SO and if users want that then just direct them there. I only referenced it because others might relate to why I am deleting post.

One of the benefits I like about this site is that we can freely and openly discuss the topics. While StackOverflow is nice when you have specific problems and know there are others who can and will give a valid answer, that is about the only real use for me it has.

I did notice that Discourse has a chat feature that is not enabled on this site. Not suggesting it at present, but something to think about. Had I know about that when making the Wiki topics, probably would have used that instead of separate Category: Wiki Sub-category: Discussion topics. :smiley:

Sorry, only read this old comment properly now.

I’d definitely like to add examples to the documentation. Like most people, the first thing I tend to want from documentation is a simple example (which test driven development encourages), and I suspect the lack of examples is a common frustration among people learning Prolog. I don’t quite have the confidence yet at my Prolog skills, so would prefer if a more experienced person decided if my examples are "worthy, but will look into experimenting with contributing via git in the coming week or so.

A really nice thing about this forum is it’s low traffic. I’ve found asking Prolog-related questions on StackOverflow a bit pointless, and I made the mistake of starting a thread on the old Usenet group comp.lang.prolog which turned into an example of why Usenet died (BTW, is kintalken actually a person or an attack bot someone created as a joke?).

No idea whether a chat facility makes sense here. These things tend to get misused. You can reorganise categories as you see fit.

Been there, done that.

From my personal experience, the faster you get into and fail and fail again the faster you learn. The people you want help from are typically the nicest and will give you the help or politely point out corrections. Sometimes you will get trolls and such, but the best thing for that is to just ignore them.

Here is an example of some horrendous code I posted here a few months back, but now because of the help and failing many times, my DCGs are so much better.

Just post it at a place where you can edit and update it and then you can always go back and change it.

One piece of advise on posting is that if you really want it to help others then you have to post it to a site that will have the content indexed by search engines and then easy to find. I know this site is indexed by several search engines, that is why I am adding the category: Wiki topics here.

Here is one example of a beginner question I asked at one site, but because of the way I wrote the title and the site it is posted on the view count is huge. Note that number is essentially from only LaTeX users. Also the count is unique, meaning that if I go back again I have already been counted, so the count does not increase.

1 Like