News for hackers. Stuff that matters.
Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by YeGoblynQueenne on Sunday March 11, 2018 @01:35PM (#16563885)
That looks nice. List comprehensions, higher-order functions and arrays in a logic-based language with CLP and planning facilities sounds great. In terms of looks, I'm not sure why but it reminds me of a cross between Python and Prolog.

There's a few things that look a bit strange though. e.g.:

  perms([]) = [[]].
  perms(Lst) = [[E|P] : E in Lst, P in perms(Lst.delete(E))].
So, "|" is a cons operator, but can't be used to take a list apart by recursively separating its head from its tail? That's a bit strange.

Also:

  Compared with Prolog, Picat is arguably more expressive and   
  scalable: it is not rare to find problems for which Picat 
  requires an order of magnitude fewer lines of code to 
  describe than Prolog and Picat can be significantly faster 
  than Prolog because pattern-matching facilitates indexing of 
  rules. 
That's just ... no :) [Because modern Prologs index all predicats, including rules, by pattern mathing and there's nothing more expressive than FOL so].
Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by ScottBurson on Sunday March 11, 2018 @03:48PM (#16564446)
I don't know exactly what's meant by "pattern-matching facilitates indexing of rules", but I wouldn't dismiss it so quickly. Zhou has long experience with a Prolog implementation (B-Prolog) and seems to know his stuff. The tabling feature in particular suggests that this is a state-of-the-art offering.

As for expressiveness, I think he's using the term in the sense of "how easy it is to express things", not "what is possible to express".

Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by YeGoblynQueenne on Sunday March 11, 2018 @06:10PM (#16565021)
>> I don't know exactly what's meant by "pattern-matching facilitates indexing of rules", but I wouldn't dismiss it so quickly.

Far as I can tell, "pattern-matching facilitates indexing of rules" means that the indexing scheme builds an index with a key for every instantiation pattern of a predicate in the program database.

Prolog uses pattern matching to match a query (or a goal) to the head of a predicate in its database. To speed things up, predicates are indexed by their functor name (the predicate symbol) and the value of their first argument, if it is a constant. That's all for default Prolog.

In modern Prologs keys are built for deeper patterns- more arguments, or compound arguments at different depth etc. The particulars depend on the implementation, but basically what I get from "pattern matching facilitates etc" is that Picat allows indexing on multiple arguments, including compound terms, which could enable matching the entire pattern of a query to an index key. Which is cool and all but it's not something you won't find in Prolog.

You can find details of one indexing scheme for Prolog in Swi-Prolog's documentation on its jiti clause indexing, here:

http://www.swi-prolog.org/pldoc/man?section=jitindex

Hope the above makes sense- I assume some knowledge of Prolog, let me know otherwise and I'm happy to clarify.

Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by ScottBurson on Sunday March 11, 2018 @10:25PM (#16565845)
Ah, that's interesting. I wasn't aware that modern Prologs did that much indexing, though it stands to reason that they would; I hadn't really thought about it.
Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by naasking on Sunday March 11, 2018 @04:14PM (#16564551)
To second the other poster, (Felleisen) expressiveness is not power, it's more like a ratio of power to program length.
Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by YeGoblynQueenne on Sunday March 11, 2018 @06:11PM (#16565022)
Sure, but that's a bit arbitrary. So I feel free to pick at it :)
Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by naasking on Monday March 12, 2018 @09:57AM (#16568139)
Not quite arbitrary, it's mathematically defined via Kolmogorov complexity, the latter just happens to be uncomputable, so we only have approximations using the best available compression techniques. It's good enough for rough estimates.
Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by YeGoblynQueenne on Tuesday March 13, 2018 @04:37AM (#16574568)
In principle, maybe. In practice people mean that they can write program P in language A in n lines, whereas they need m lines to write P in language B, therefore A is better than B because m > n.

Which of course means nothing- I can probably write a hello world in 1000 lines in Java, if I try really hard. Just because I can find a shorter program in my favourite language but can't find one in yours, doesn't mean one doesn't exist. And even if you yourself can't find such a program, doesn't mean it doesn't exist.

That's what I mean by "arbitrary": in practice, people come up with whatever interpretation of "expressive" suits them to claim their favourite language is more of that.

Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by naasking on Tuesday March 13, 2018 @08:56AM (#16575711)
> Just because I can find a shorter program in my favourite language but can't find one in yours, doesn't mean one doesn't exist. And even if you yourself can't find such a program, doesn't mean it doesn't exist.

This doesn't matter. Ordering all program strings by Kolmogorov complexity means you can find the shortest program that can produce a certain output string.

Re:Picat: A Logic-Based, Multi-Paradigm, Programming Language by YeGoblynQueenne on Tuesday March 13, 2018 @11:48AM (#16577091)
I suggest the string "The heat death of the universe should be anytime now".