|
In Arabic the numbers are written left to right.
|
|
|
|
|
I am not sure but the direction could have changed in last 100-400 years because of the influence of the western culture.
|
|
|
|
|
With the "programming" aspect of your post aside...
Nikunj_Bhatt wrote: decimal numbers are Arabic numeral I'm confused... what does this mean? How is a number (decimal or otherwise) specifically Arabic? (and therefore specifically RtL)
Nikunj_Bhatt wrote: Maths, the number language, is actually written RtL What do you mean by this? If I write a sum on a piece of paper, I would write:
1 + 2 = 3
|
|
|
|
|
The numbers that we are using is the decimal numbers a.k.a. Arabic numerals. Here is the history of the numbers: Arabic numerals - Wikipedia[^]. The decimal numbers are called Arabic numbers because they were invented by Arabs (however Zero was invented in India, it is also part of Arabic numbers).
So,
1 + 2 = 3 is a correct way in LtR while
3 = 1 + 2 is correct way according to RtL (Arabic, Hebew, etc. RtL languages, however this is now not used because of international Mathematics influence.)
|
|
|
|
|
Just because they may have originated in another language does not mean they are still that language. It depends on the context used. Otherwise you could easily argue a lot of English is not actually English because it originated in another language... it doesn't matter where it came from it's only how it's used that matters.
If your argument is that Maths is it's own language, then it can also defined it's own read order (i.e. LtR), it doesn't matter where the numbers original came from and how they were originally read.
My point is, there is no reason to why they have to be read RtL just because they are decimal numbers.
|
|
|
|
|
musefan wrote: If your argument is that Maths is it's own language, then it can also defined it's own read order (i.e. LtR), it doesn't matter where the numbers original came from and how they were originally read. My concern is about programming, not about Maths. So, Maths can have its own read-write direction but in programming we can define what is logical - because programming is all about logic, isn't it?
|
|
|
|
|
musefan wrote: I'm confused... what does this mean? How is a number (decimal or otherwise) specifically Arabic? (and therefore specifically RtL) Our numbering system (and the number 0) are arabic inventions. Romans use a different system, and do not have a sign for nothing.
Doesn't make the number itself an Arabic thing, only our current defacto way of encoding these.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
It is interesting to notice that numbers are written the same way in LtR and RtL languages, with the most significant digit to the left.
Also notice that in a number of languages, including old English, it was common to read (and write as words) e.g. four-and-twenty, as if read RtL, rather than twentyfour. In German, you still read numbers RtL, at least up to one hundred. Norwegian was similar until a reform in the 1950s.
(If you try to bake twentyfour blackbirds in a pie, the rythm will be screwed up...)
|
|
|
|
|
Oh I get that, my confusion is how does that decide how we should use the symbols. Maths is the language, and Maths decides how the language should be read. Not the language where some of the symbols originated.
|
|
|
|
|
We had maths before we had symbols for numbers. Then, we found that the Roman system has its limitations in doing math. So we switched.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I spent a few years programming in Planc - Programming LAnguage for Norsk data Computers. Fairly Pascal-like (plus a number of system programming features), but assignments were LtR, like: I + J =: K;
(It also had the very useful swap assignment - if you wrote: newI =: I =: oldI; the newI would be assigned to both I and oldI, but if you rather used newI :=: I =: oldI; the assignment to I would carry the old value of I over to following assignment. So A :=: B =: A; is a full swap.)
You could say that APL is strictly RtL: it has no operator priorities; you have to control all out-of-sequential-order calculations with parentheses. There are two ways to conceptualize this: If you like to work bottom-up, collect the small pieces into larger structures, finally being assigned to a variable, then you start at the right end and read to the left. The alternative is to do it top down, reading from left to right. All the special APL characters makes it difficult to give a true example, but to write it in a Pascal-like way:
TotalCost := FixedCost + UnitCost * Amount1 + Amount2;
TotalCost is assigned a new value, that's the top level. The value is a sum of a FixedCost and something else, what ever the details of the "something else" is. If you want those details, you read on to see a UnitCost multiplied by something, presumably a number of units. To see the details of how the number of units are calculated, you read to see that two amounts are added. The more details you want, the further you read.
If you turn it the other way around, in a LtR language
(Amount2 + Amount1) * UnitCost + FixedCost =: TotalCost;
you start with two out-of-context amounts added together, but you really don't know for which purpose. You multiply it by a value, but there is still no indication of why. You add a FixedCost, but only at the very end of the statement do you realize what you are doing all this for!
Top-Down design has been accepted in systems design, and even in code design, since the 1970s, but when we get down to real programming, we still insist on assembling small pieces without knowing the purpose of it.
I liked the Planc LtR style. But I also like the APL top-down-approach when reading it LtR. I agree that the current mainstream languages makes your attention jump back and forth; I would rather have the APL or Planc philosophy.
|
|
|
|
|
Member 7989122 wrote:
Top-Down design has been accepted in systems design
Did that happen on the same day a single religion has been accepted, a single government form has been decided and a single indentation pattern was agreed upon for the whole world?
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Maybe I should have been more precise: It is accepted as one of several options in systems design.
Not everyone is following the "agile" apporach to extremes, the one where you do, like: "Oh, so you have a problem? Let's start with 'int main(int argc, char** argv) { return 0;}'. There! Now we are going at it. So what is your problem?"
I know that "waterfall" is one of the baddest swear words you can use in today's software development world. But when you go through our company's process description from a customer requirement spec to the product delivery, it looks awfully close to a waterfall. Each individual step is managed according to agile principles (this is stressed a lot internally), and if I had made even slight side remarks about the process having strong resemblande to the waterfall model, I would have been fired the same day. So I don't.
I believe this is far more common than up-to-date programmers want to know of. They want to enforce a pure agile strategy at their step of the waterfall, believing that that is everything there is. But in a large, established product oriented company that still maintenance on products developed ten years ago, and considers what the market will want five years into the future, you very easily end up with something very much like a waterfall. We just call it by different names, and avoid the swear words.
|
|
|
|
|
Sure, do it. By the way TI-BASIC has an -> operator for assignment, of course working left to right. And Smalltalk has left-to-right evaluation of operations instead of relying on operator precedence (which is initially confusing, but you don't have to remember the relative precedences of uncommon combinations of operators).
|
|
|
|
|
Nikunj_Bhatt wrote: So, what are your views on creating a new programming language which follows proper LtR execution?
What "problem" would that solve?
Yeah, I didn't think so. There's plenty of languages to know already, I don't think anybody wants another one that only "fixes" this.
|
|
|
|
|
It may not solve any problem. I presented my thought from logical view as programming is all about logic. I have already wrote that I know that there are already plenty of programming languages; I am not actually going to create any language.
|
|
|
|
|
Hold on.
Are we talking about computer programming languages, or people programming languages?
Because computers don't even know what right and left are, so they don't care.
If you're really desperate to fix this problem-that-ain't-even-remotely-a-problem, then use a modular approach, where which "direction" the flow goes depends on the structure of the source data and whatever overloading you have set up.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
I am talking about computer programming language having more logical syntax while remaining fairly easy to understand for programmers.
|
|
|
|
|
Natural and formal languages (math being one of the latter, programming languages are another example) have different use cases. As hard as it is to create an exact statement in, I dare to say, every single natural language (although some are better for this task than others), as easy it is in the formalized language of math or programming (I dare to say that C++'s convoluted syntax is an exception here). My point is that applying a set of rules not developed for formality to something that has to be formal may not yield the best results.
|
|
|
|
|
Or use a good one, already invented.
POP-2 - Wikipedia[^]
With lambdas, managed mem, closures (full and partial), user-defined operators, user-defined setter functions, functions with multiple results, incremental compiler ...
And with alternative ltr syntaxes:
f(a,b) ->x ->y
or
a; b.f() ->x ->y
|
|
|
|
|
Wow! That's what I am talking about. It seems very much similar to my idea of a proper logical programming language. Thank you.
|
|
|
|
|
You can already read this right to left.
"=" is read as "is assigned to" not "equals". duh!
x = a + 12
Could be read as
12 added to a is assigned to x
Or left to right:
x is assigned a added to 12
Is your language going to support order of operations that follow neither direction?
|
|
|
|
|
englebart wrote: x is assigned a added to 12 You wrote in English. It is like passive voice. Instead of "I have done this" you are writing "It has been done by me".
If we write x = a + 12 , it can be understood like this: (1) create a variable "x" (allocate memory), (2) add value of the variable "a" to 12 (store the sum somewhere in memory), (3) store the sum in variable "x".
If we write a + 12 = x (OR a + 12 -> x ), it can be understood like this: (1) add the value of variable "a" to 12 (store the sum somewhere in memory), (3) Create a variable "x" (allocate memory), (4) store the sum in variable "x".
In the first approach, it is like - the system is allocating memory first without knowing the result. In the second approach, it is like - the system is first determining the result and then allocating memory according to the result. This second approach looks more logical way of executing and writing code.
I think, the 1st approach is suitable to programming languages of .NET, C based, Java, etc. where variables needed to be defined before assigning values; while the 2nd approach is suitable for languages like JavaScript, PHP, etc. where variables can be defined/initialized anywhere in the code.
|
|
|
|
|
|
My views ?
1. you are wasting your time.
2. using = for assignment is evil, but, perhaps a necessary one we are stuck with forever.
3. post-fix (RPN) is no more natural, or unnatural, than any other notation. a great benefit of RPN is that you can parse it without need for recursive descent to figure out execution order.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|