6 ms·
I fell like this is a troll so good I'm even questioning if it's really a troll. But in short: you can't require non-ascii symbols for languages which are suppo
by viraptor 7y ago
I fell like this is a troll so good I'm even questioning if it's really a troll. But in short: you can't require non-ascii symbols for languages which are supposed to be accessible. And <- won't work since it's a valid syntax in other contexts.
- ken 7y agoI heard the same complaints about indentation for scope, 20 or 25 years ago, and yet it seems to have worked out OK for them. It's interesting how many of these rules we know to be true, aren't. I for one am tired of programming languages trying to eke out the best ASCII art they can manage with the symbols that happened to end up on American keyboards by historical accident. Or wanting to look 97% the same as ANSI C, even though their semantics are completely different. For the people who really cannot type anything but US-ASCII on their DEC VT100 terminals, and don't use an editor or operating system which allows them to compose other characters, there are still ASCII combinations that look more or less like a left-arrow, and which are invalid Python syntax today.
- catalogia 7y agoAPL generally feels like a troll, like INTERCAL, but from my interactions with APL advocates I think they are sincere.
- viraptor 7y agoYeah, I wouldn't even think it's weird in APL areas. But when someone says "let's take one of the most beginner-accessible languages and add a required symbol which is not on the keyboard", that's... something else.
- m463 7y agoI really liked APL when I learned it. I actually think it sort of aligned with the eccentric academics that used it - folks that published research papers with figures requiring the greek alphabet and math symbols. But I can see how people would think it was a troll. I recall it doubled-down on the crazy character set and required overstriking multiple characters to create some operators (for example box + divide to get a domino like character) By comparison walrus is fine, and it is even friendlier with the disarming animal-themed name.
- squiggleblaz 7y agoLike ⌹? I wonder what it means. There's all these APL symbols in Unicode and I don't understand what they mean. But they never look serious enough to make me want to learn the language. I guess the modern APL character soup is Haskell where people can propose (but never implement) something like ⟦ xx ∋ yy ⟧ which looks vastly more serious and any stranger can immediately grasp its meaning, a trait shared with every ascii alphabet soup programming language in the world.
- robomartin 7y agoIf you look at the symbol, it looks like a rectangle with a division symbol inside. A rectangle is reminiscent of the shape of a matrix. This is what it does: Monadic form: Matrix inverse. a ← 3 3 ⍴ ⍳9 a 1 2 3 4 5 6 7 8 9 ⌹a ¯4.849821517E14 9.699643034E14 ¯4.849821517E14 9.699643034E14 ¯1.939928607E15 9.699643034E14 ¯4.849821517E14 9.699643034E14 ¯4.849821517E14 Dyadic form: Matrix division. b ← 1 2 3 b ⌹ a 0.7357839757 ¯1.471567951 1.069117309 To put this into context, say you have a set of linear equations with three unknowns, x, y and z: -8 = 3x + 2y - z 19 = x - y + 3z 0 = 5x + 2y We want to solve for x, y and z. Matrix division is the answer. First we grab the coefficients and stuff them into a matrix: c ← 3 3 ⍴ 3 2 ¯1 1 ¯1 3 5 2 0 c 3 2 ¯1 1 ¯1 3 5 2 0 Next we assign the constants to a vector (which can also be considered a 1x3 matrix): k ← ¯8 19 0 k ¯8 19 0 Note that APL uses the "high minus" to denote negative values in order to avoid confusion with negation "-". For example: -1 2 3 yields: ¯1 ¯2 ¯3 If you only wanted a negative 1 the correct syntax would be: ¯1 2 3 Anyhow, we now have: k ¯8 19 0 c 3 2 ¯1 1 ¯1 3 5 2 0 In order to solve the system of three simultaneous equations with three unknowns we just need to use matrix division: k ⌹ c 2 ¯5 4 The answer is a vector where the elements correspond to x, y and z, respectively. This will work so long as the matrix has an inverse and will work for a system of n equations with n unknowns. Incidentally, if we want to keep all three equations, constants and coefficients in a single matrix we can do that just as well: d ← 3 4 ⍴ ¯8 3 2 ¯1 19 1 ¯1 3 0 5 2 0 d ¯8 3 2 ¯1 19 1 ¯1 3 0 5 2 0 We can then use the same matrix division expression to solve the system of equations by slicing-up the matrix to get our constants and coefficients: This "take"s (↑) the first column from the matrix (along the second dimension, hence the [2])... 1↑[2]d ¯8 19 0 and this takes the last three columns: ¯3↑[2]d 3 2 ¯1 1 ¯1 3 5 2 0 You can also "drop" (↓) the first column, which is a better idea because this makes the code independent of the size of the matrix: 1↓[2]d 3 2 ¯1 1 ¯1 3 5 2 0 Plugging into the prior expression of this form: k ⌹ c we would have: (1↑[2]d) ⌹ 1↓[2]d 2 ¯5 4 This gives us a 3x1 matrix as the result. If we want a vector all we need to do is add the "ravel" operator "," (the monadic form of concatenation) on the left: ,(1↑[2]d) ⌹ ¯3↑[2]d 2 ¯5 4 Or, we could, if it made sense "laminate" the column vector result on the back side of the matrix so that we have constants, coefficients and the solution vector all in a single variable or data structure. Like this: d ← d,(1↑[2]d) ⌹ ¯3↑[2]d d ¯8 3 2 ¯1 2 19 1 ¯1 3 ¯5 0 5 2 0 4 That gives us everything in a nice tight package that we can use for other work. Extracting the various elements from this matrix is easy: Constants: 1↑[2]d ¯8 19 0 Results: ¯1↑[2]d 2 ¯5 4 Coefficients: ¯1↓[2]1↓[2]d 3 2 ¯1 1 ¯1 3 5 2 0 or, using indexing instead of sequential "drop" (the disadvantage being that the "drop" approach is independent of matrix size): d[;2 3 4] 3 2 ¯1 1 ¯1 3 5 2 0 If these concepts are foreign to you, google "solving simultaneous equations with linear algebra". It's neat stuff.
- thomasahle 7y agoGo managed to use <- still..
- jerf 7y agoBeing "valid syntax in other contexts" is language dependent. Go works by taking <- as an operator at a higher priority than the alternative parse, if indeed the "alternative parse" is even possible in the grammar (I'm not checking for a HN post); if you start with https://play.golang.org/p/S_XOiKdyj1A https://play.golang.org/p/S_XOiKdyj1A and remove the space after the less-than symbol and hit run, you'll see it no longer compiles properly. So <- only has one interpretation in Go. By contrast: $ python Python 2.7.15+ ... >>> x = -3 >>> if x<-2: ... print("Hello world") ... Hello world <- appears in a perfectly valid context now that Python parses, in what happens to be the very place that is under discussion, so changing x<-2 to be "set x to 2" would be a non-backwards compatible change in Python.
- pmoriarty 7y agoFor a language that's infamous for its strictness in regards to whitespace, I'm surprised "x<-2" is allowed. Why not just require whitespace around every operator?
- memetichazard 7y agoPython isn't that strict about whitespace? It's just using indents to delineate blocks and newlines implicitly terminate statements (unless you have an unclosed brace). Anywhere else, you can add as much whitespace as you want.
- NieDzejkob 7y agoIt's not strictness with regards to whitespace, it's just using indentation to delimit blocks. The rest is less strict than C, not requiring spaces between numbers and keywords: print(1if 2else 3) is valid Pythonese.
- goatinaboat 7y agoBut in short: you can't require non-ascii symbols for languages which are supposed to be accessible While I agree that everything should be ASCII the Python community believes everything should be Unicode, since Python 3.
- thayne 7y agoThere is a difference between using unicode for strings, which necessarily must support internationalization, and the syntax of the language itself
- geofft 7y ago1. ASCII is a subset of Unicode. You can be both. 2. The change in Python 3 is the introduction of a distinct string type specifically because there are things that are not Unicode, namely bytestrings. Several things that could have been implicitly Unicode in Python 2 have become not-Unicode in Python 3 (e.g., the return value of subprocess.check_output). 3. You enter bytestring literals in ASCII.
- squiggleblaz 7y agoCan you enter BEL, NUL, line feed, and " in a bytestring literal, and if so, can a person seriously say with a straight face that 0x5c 0x6e is mathematically and physically identical with 0x0a. I suppose I could believe in ascii bytestring literals if the string literal were length tagged pascal strings.
- rumanator 7y ago> 1. ASCII is a subset of Unicode. You can be both. You can encode a character, just like you can express Farsi symbols and smiley faces and other emojis, but no keyboard layout supports it. What's the point of supporting a character if no standard input device lets you type it?
- filmor 7y agoPython 3 also allows for non-ASCII identifiers.
- aaron_m04 7y agoIt was successful trolling. Look at all the comments...