News for hackers. Stuff that matters.
Re:The Power of Prolog by carapace on Wednesday April 08, 2020 @04:19PM (#22816630)
I want to say thank you, for your book and for all the work you're doing promoting and improving Prolog.
Re:The Power of Prolog by triska on Wednesday April 08, 2020 @04:30PM (#22816749)
You are very welcome!

I greatly enjoy all your postings about your Prolog-based interpreter for Joy:

https://osdn.net/projects/joypy/scm/hg/Joypy/blobs/tip/thun/...

I impulsively upvote this every time I see it. Thank you for sharing such an interesting project!

Re:The Power of Prolog by carapace on Wednesday April 08, 2020 @08:30PM (#22818656)
You're very kind. It's unfinished, and I doubt whether it will ever be useful for anything (other than just being kinda neat in and of itself.) I need to deal with compiling loops/recursion/fixpoints. But thanks! I appreciate it.

Your advice to use CLP(FD) for the semantics of integer math operations was fantastic!

Re:The Power of Prolog by mthom on Thursday April 09, 2020 @11:02AM (#22823200)
You don't mind if I port Thun to Scryer Prolog, do you? With full credit to you, of course. I'd like to include it as an example.
Re:The Power of Prolog by carapace on Thursday April 09, 2020 @03:00PM (#22825968)
Not at all, that would be awesome. It's GPL'd, have at it. (^_^)

I typically use SWI Prolog but I hope the code is mostly portable. The parser uses a couple of DCGs from the "basics" lib but I think those are also portable or at least simple to re-implement.

The tricky bit might be the semantics of math (and comparison) ops. I've tried two other sets of semantics, one that attempts to perform math operations (and catch the errors if e.g. an arg is a logic var rather than an int) as you go, and another that just builds expression trees (evaluation is delayed) like so:

    func(+, [int(A), int(B)|S], [int(A + B)|S]).
Just to point out, in SWI Prolog the ints are "BigNums" while in GNU Prolog they're machine words (so modular arithmetic, mod 2^32). You could use Rationals or make up some other semantics. This all gets into Categorical paradigm programming. http://conal.net/papers/compiling-to-categories/ The same (point-free) expression can be used to develop concrete programs over various categories: Hardware circuits, partial evaluation, differentiation, dataflow graphs, and so on.
Re:The Power of Prolog by felixyz on Thursday April 09, 2020 @02:42AM (#22820356)
Hadn't seen this before. How nice that you called it Thun! Warms my heart.
Re:The Power of Prolog by carapace on Thursday April 09, 2020 @03:14PM (#22826128)
Cheers! Manfred von Thun seems like he was a pretty great guy. I wanted to honor him.