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.
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.