6 ms·
Syntax across languages
- CmonDev 12y agoTo me it makes it more obvious that succinct != more readable: (top two) http://rigaux.org/language-study/syntax-across-languages/Fnctn.html#FnctnFnctCall http://rigaux.org/language-study/syntax-across-languages/Fnc...
- jarcane 12y agoThere's a great guide like this for Lisp dialects that I often refer to here: http://hyperpolyglot.org/lisp http://hyperpolyglot.org/lisp They also have a number of similar comparative guides on their main page now: http://hyperpolyglot.org/ http://hyperpolyglot.org/
- fnordsensei 12y agoInteresting, but it seems to be unaware of some Clojure libs. It suggests, (.trim " foo ") ;; Java interop instead of, (trim " foo ") ;; With clojure.string Clojure.string is available from Clojure 1.2, which is ostensibly the version used in the comparison, yet is for some reason not actually utilized. (By the way, we're approaching Clojure 1.7 at the moment)
- jarcane 12y agoI did notice it seemed to use the Java fallbacks a lot, yeah, but I don't use Clojure much so didn't realize it was that out of date on the CLJ side.
- rx4g 12y agoNow I kind of want to cross-reference this with the TIBOE index and make a frankenlanguage with the most popular syntax.
- michaelcampbell 12y agoDidn't PL/1 try that? (Or maybe they made the classic error of "worst syntax" instead... not sure. Been a few years since I looked at it =)
- towardsCL21 12y agothe seed for random number in CL: (make-random-state &optional state)
- mdcox 12y agoA cursory skim leaves the impression of just how alone Haskell is on many syntactic choices (though supposedly with alot in common with "Merd".) I never took the time to learn Haskell, but it always looks beautiful on an aesthetic level, which differentiates it from the other loners in the list. Can anyone point me to any papers/documentation/discussion on WHY certain syntax decisions were made? Many could have been arbitrary choices to match the constructs, but the way the community presents itself makes me think there's more to it.
- tome 12y agoHaskell inherits a lot from Standard ML. This paper explains a lot of the design decisions of Haskell, syntax amongst them: http://haskell.cs.yale.edu/wp-content/uploads/2011/02/history.pdf http://haskell.cs.yale.edu/wp-content/uploads/2011/02/histor...
- Retra 12y agoThe best part of Haskell is that function application is just whitespace. f x = f(x) I would attribute almost 90% of it's elegance to that idea alone. (This is not an exact number or measured estimate.) I also have a major thing for pattern-matching, and it always seems nice when you know that's what you're looking at. For instance, it is far easier to understand what `int * * var` is in C if you see it as a kind of pattern de-structuring.
- tormeh 12y ago>The best part of Haskell is that function application is just whitespace. It's the worst part, in my opinion. Is A B C D equal to A(B(C(D))), A(B,C,D), A(B,C(D)), A(B(C),D) or A(B(C,D))? Often you need to disambiguate with parentheses, so I guess there is some default interpretation that you can assume when reading code, but in the end it just looks like an unnecessary mental translation step. Lisp has weird syntax, but lisp has a reason to have that syntax. Haskell has a weird syntax because it wants to either be different for different's sake or to just be plain inaccessible.
- 12y ago
- blt 12y ago"NB." for comments in J made me laugh.
- TazeTSchnitzel 12y agoDisappointed there's no integer division, or explanation of the different division operator behaviours (some languages have separate integer and float operators, some use floats if indivisible but otherwise integers, some do integer or float depending on the operand types, etc.)
- mwsherman 12y agoFun read. A nit, if the author is reading: C# allows Unicode letters as identifiers, so the variable regexp should reflect that. This might be handy: http://www.regular-expressions.info/unicode.html#category http://www.regular-expressions.info/unicode.html#category Also, would love to see Go in there. Similar identifier regex.
- comex 12y agoSo does C, although compiler support is limited.
- TheDong 12y agoI personally find the site "Rosetta Code" [0] much more useful for this sort of thing. [0]: http://rosettacode.org/wiki/Rosetta_Code http://rosettacode.org/wiki/Rosetta_Code
- aidenn0 12y agoI just skimmed this, but a large fraction of their information was just wrong for common-lisp, even if you assume a standard readtable. One example: they state "anything without a space and is not a number" for identifiers; it's hard for that to be more wrong. The actual rule is: a single token that could either be a symbol or a number should start with any non-macro character, and can be made up of any combination of non-macro and non-terminating macro characters, as well as any escaped characters. For example: a\ b Is a valid symbol. Now that we have a token that is either a symbol or a number, we need to distinguish which; that's slightly more complicated, so I'll link the spec (which includes an EBNF): http://www.lispworks.com/documentation/HyperSpec/Body/02_ca.htm http://www.lispworks.com/documentation/HyperSpec/Body/02_ca....
- cstuder 12y agoSomething that recently caused an interesting amount of problems for me was the simple fact that the modulo operation with negative numbers changes its behaviour depending on the programming language: http://rigaux.org/language-study/syntax-across-languages/Mthmt.html#MthmtMdl http://rigaux.org/language-study/syntax-across-languages/Mth... For a more complete list: http://en.wikipedia.org/wiki/Modulo_operation#Remainder_calculation_for_the_modulo_operation http://en.wikipedia.org/wiki/Modulo_operation#Remainder_calc...
- kuschku 12y agoWhile we had to implement the Modulo operation as part of an assignment in assembler, several other students and me started discussing this topic, ultimately settling on "do whatever you want, just write down what it’s supposed to do", because we couldn’t really agree on which would be the better solution.
- stouset 12y agoActually, if you consider strict nomenclature, modulo should be positive since it's a mathematical concept and that's what it's mathematical definition would require. The fact that it has been (ab)used as a shorthand for the remainder of integer division is unfortunate, but that suggests there ought to be a "remainder" keyword (or operator). We've gotten into a bad habit of calling things by the name of their implementation rather than by what we actually expect of them. This confusion is just a side effect of that problem.
- jarcane 12y agoThis is why Racket has both.
- AustrianSausage 12y agoI'm really missing TeX. Could someone add it?