4 ms·
The script is import util. input_data(Tri) => Lines = read_file_lines("triangle.txt"), Tri = new_array(Lines.length), I = 1, foreach(Line
by pmontra 7y ago
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/ http://reia-lang.org/
- didibus 7y agoI think most designers of alternative paradigm languages also prefer the alternative syntaxes.
- pmontra 7y agoYou're probably right, and those languages risk staying alternative forever.
- pessimizer 7y agoThe idea that typing commas is far more difficult than typing semicolons is common, but bizarre. I feel like you're using a lot of words here to rationalize being accustomed to semicolons or significant whitespace as a logical preference rather than an aesthetic one. Consider commas somewhere between a minimalist and maximalist aesthetic (" " < "," < ";"), but one that values consistency.
- YeGoblynQueenne 7y agoI changed all the commas to "and"'s" and the dots to ";"'s (except in a.b statements): 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?
- pmontra 7y agoNo. My point is that language designers should try to implement different paradigms with mainstream syntax. This if they are interested in making their languages mainstream, which might not be their goal. The script should do without the ands, the commas and the colons. The end of line should be the and, or what the language understands to be the end of a statement. By the way, the dot or the semicolon after the end look really redundant.
- deleted 7y ago[deleted]
- YeGoblynQueenne 7y ago>> The end of line should be the and, or what the language understands to be the end of a statement. The problem with that is that the "," is there not to separate statements ("literals") but to declare a relation between them, specifically, conjunction. Conjunction is one relation that you may way to declare between literals. There is also disjunction and implication. So you do need something to separate "A and B" from "A or B" and "A if B". You say- "use whitespace for the and". OK. But then, what about the "or" and the "if"? And if we use special symbols for the "or" and the "if" then what's the point of not using one for the "and" also? As to "block" delimiters, like "." or ";" etc. As far as I can tell the only languages that do not have "block" delimiters are the kind you can find on https://esolangs.org/wiki/ https://esolangs.org/wiki/, and that is for reasons of a) readability, actually and b) convenience in compiler writing.