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.
Picat – a logic-based multi-paradigm programming language
21–30 of 39 posts
Re: Picat – a logic-based multi-paradigm programming language
#22Re: Picat – a logic-based multi-paradigm programming language
#23Really 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.
With functional programming, one is able to translate thoughts more directly. Non-programmers actually have an easier time with functional concepts like mapping than for loops, non-local mutation, etc.
At any rate, imperative languages have a legacy of frankly buggy, shitty software. As programs get larger and more concurrent, this problem is getting much, much worse. That's why functional(ish) libraries like Redux are so popular. They can help tame this complexity.
Imperative programming absolutely has its place in certain situations like systems or numerical programming, but it is a poor tool for most things people program. Rust, I think, is imperative programming done right. While it's a bit confusing with all the pointer types, it has the tools needed to safely mutate, etc.
Re: Picat – a logic-based multi-paradigm programming language
#24Earlier 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 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 writ…
Re: Picat – a logic-based multi-paradigm programming language
#25Earlier 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 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 writ…
Re: Picat – a logic-based multi-paradigm programming language
#26Is it just me, or is there an uptick in boutique programming language posts on HN lately? Not complaining, just curious if anyone else has noticed.
It happens when the current programming languages fail short of solving the most difficult problems the industry faces and programmers explore some paradigms that solve them nicely, but those paradigms haven't been integrated into a single coherent platform.
This shift is pretty much happening with reactive functional programming - which solves asynchronous calls in the web -, and to some extent with large-scale module composition, which still lacks a good widely known solution.
Re: Picat – a logic-based multi-paradigm programming language
#27Earlier 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 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 writ…
import util;
input_data(Tri) =>
Lines = read_file_lines("triangle.txt") and
Tri = new_array(Lines.length) and
I = 1 and
foreach(Line in Lines)
Tri[I] = Line.split().map(to_integer).to_array() and
I := I+1
end;
Is that better?Re: Picat – a logic-based multi-paradigm programming language
#28Earlier 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.
You do need the Swi-Prolog IDE for that though.
Re: Picat – a logic-based multi-paradigm programming language
#29Congratulations 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…