Live data from Hacker News

Picat – a logic-based multi-paradigm programming language

picat-lang.org

11–20 of 39 posts

Re: Picat – a logic-based multi-paradigm programming language

#11
post #7
post #6

Congratulations for the code examples on the home page. Not every language designer does that. Plenty of examples on HN. My only criticism is about dots and commas, and I know where they come from. Especially as > Picat, as a scripting language, is as powerful as Python and Ruby. But I'm not adding commas and dots to the end of each line, it's a little nightmare. I'm staying with Python and Ruby for scripting. Is the…

The commas and dots are operators, not syntax. one, two, three. Is essentially compiled down to: if (one && two && three) { return three; } Whereas one, two, three; one, four. compiles down to: if (one && two && three) { return three; } else if (one && four) { return four; } So yeah, it's not syntax. , === && ; === || . marks end of a condition, so } in C.

The script is

  import util.

  input_data(Tri) => 
    Lines = read_file_lines("triangle.txt"),
    Tri = new_array(Lines.length),
    I = 1,
    foreach(Line in Lines)
        Tri[I] = Line.split().map(to_integer).to_array(),
        I := I+1
    end.
In the mind of an imperative scripting developer those commas are (useless) semicolons.

I wrote a little Prolog some 30 years ago. Probably those commas and dots have the same function, logic and, as you write.

I understand that it's a core feature of the language, but its really awkward when using Picat imperatively. I've seen this dynamic of obeyibg to tradition in many languages. The vast majority of developers are used to imperative languages. If designers of functional, logic, etc languages want to hijack those developers to their own language they could try to be creative and bold and give those developers a syntax their are familiar with.

Elixir has a Ruby like syntax to Erlang and had some success at onboarding Ruby developers. But it wasn't bold. Example: they didn't have courage to turn GenServer into a Class with a CPU. It's still a bag of functions, partly called by clients, partly called by the server, with method names (if it was a class) hidden in arguments and explicit state management.

The Reia language was a bolder attempt but unfortunately its designer liked Elixir and killed his project. My guess: there would be many more Reia developers than Elixir ones by now.

http://reia-lang.org/

Re: Picat – a logic-based multi-paradigm programming language

#12
I won't know who Hakan Kjellerstrand is, but if you quote him you should either put [sic] following "suites" or put [suits] instead of it. Gives a bad impression straight off the bat. You could argue language is different from programming but to my subconscious mind it speaks of a lack of attention to detail and excellence.

Re: Picat – a logic-based multi-paradigm programming language

#13
post #9
post #7

Earlier quoted context omitted.

The commas and dots are operators, not syntax. one, two, three. Is essentially compiled down to: if (one && two && three) { return three; } Whereas one, two, three; one, four. compiles down to: if (one && two && three) { return three; } else if (one && four) { return four; } So yeah, it's not syntax. , === && ; === || . marks end of a condition, so } in C.

The issue I see is that a . and a , are tiny little marks on the screen that are super easy to miss and, at a glance, the . , ; all can look the same. Maybe with practice you can spot the differences easier, but certainly as a newcomer to the language its a lot of extra cognitive load. && and || at least are super obvious.

I don't write Picat, but when I write Prolog the color scheme for Emacs gives those operators a bright color so they stand out.

Re: Picat – a logic-based multi-paradigm programming language

#14

I won't know who Hakan Kjellerstrand is, but if you quote him you should either put [sic] following "suites" or put [suits] instead of it. Gives a bad impression straight off the bat. You could argue language is different from programming but to my subconscious mind it speaks of a lack of attention to detail and excellence.

If you zoom you can see he is a coauthor of the book in the upper left corner.

Re: Picat – a logic-based multi-paradigm programming language

#15
post #13
post #9

Earlier quoted context omitted.

The issue I see is that a . and a , are tiny little marks on the screen that are super easy to miss and, at a glance, the . , ; all can look the same. Maybe with practice you can spot the differences easier, but certainly as a newcomer to the language its a lot of extra cognitive load. && and || at least are super obvious.

I don't write Picat, but when I write Prolog the color scheme for Emacs gives those operators a bright color so they stand out.

Right. As someone who uses raindbow parentheses, I should have immediately thought that it would be solved by the editor. Still, I don't like if readability relies on the editor too much, since you often want to paste or read code elsewhere (on HN, stackoverflow, github, random websites, etc) that may not know about your non-mainstream language.

Re: Picat – a logic-based multi-paradigm programming language

#16
post #9
post #7

Earlier quoted context omitted.

The commas and dots are operators, not syntax. one, two, three. Is essentially compiled down to: if (one && two && three) { return three; } Whereas one, two, three; one, four. compiles down to: if (one && two && three) { return three; } else if (one && four) { return four; } So yeah, it's not syntax. , === && ; === || . marks end of a condition, so } in C.

The issue I see is that a . and a , are tiny little marks on the screen that are super easy to miss and, at a glance, the . , ; all can look the same. Maybe with practice you can spot the differences easier, but certainly as a newcomer to the language its a lot of extra cognitive load. && and || at least are super obvious.

Especially when you are used to more or less filtering out '.', ',', and ';'.

Re: Picat – a logic-based multi-paradigm programming language

#17
post #5

Really bad idea... please no imperative

Actually I see all the non-imperative ways as lost time in software development. At some point we will realize that people think imperatively.

Speak for yourself. I find declarative programming to be far more intuitive, as it lets me think about how I should go from the data I have to the data I want. Thinking about programs in terms of the steps they're taking to do something generally bogs people down with irrelevant implementation details.

Re: Picat – a logic-based multi-paradigm programming language

#20

I won't know who Hakan Kjellerstrand is, but if you quote him you should either put [sic] following "suites" or put [suits] instead of it. Gives a bad impression straight off the bat. You could argue language is different from programming but to my subconscious mind it speaks of a lack of attention to detail and excellence.

If you search for constraint programming examples on the internet, you will eventually end up on his web page.
Post reply on HN