6 ms·
Usually I love looking through new programming languages, but the docs here don't give me any motivation for the language, or even any reasonably non-trivial ex
by BruceIV 12y ago
Usually I love looking through new programming languages, but the docs here don't give me any motivation for the language, or even any reasonably non-trivial examples. Is it just supposed to be C++ with Lots of Irritating Silly Parens?
- S4M 12y agoI had a brief look at the solutions of the problems from Project Euler in L++ [0]. As you say, it seems like C++ with the LISP syntax. On the other hand, it can be a LISP where you can trivially import some C++ libraries (as in the source code: (include "iostream" "vector") ). But since I couldn't find macros and eval in the docs, I would err on the side of C++ with the Silly Parens for now... [0]: https://bitbucket.org/ktg/l/src/cb93b589c03ec1e39007c1907deb03d0787f9f17/ex/?at=master https://bitbucket.org/ktg/l/src/cb93b589c03ec1e39007c1907deb...
- ktg 12y agov0.2: Macros are supported via Racket's macro system define-syntax.
- deleted 12y ago[deleted]
- pmelendez 12y agoA Lisp dialect that compiles to C++ is interesting. I am not sure if features like Lisp macros would be provided, but still you can compare the versions of 99 bottles of Beer and see a significant difference: http://www.99-bottles-of-beer.net/language-c++-111.html http://www.99-bottles-of-beer.net/language-c++-111.html I find the L++ version to be very way more elegant. Edit: More examples... https://bitbucket.org/ktg/l/src/cb93b589c03ec1e39007c1907deb03d0787f9f17/ex/?at=master https://bitbucket.org/ktg/l/src/cb93b589c03ec1e39007c1907deb...
- jeorgun 12y agoWell, yeah, an actual example of realistic code is going to be more elegant than something that's literally self-parody. int main() { for (int i = 99; i--;) { std::cout << i << " bottles of beer on the wall, " << i << " bottles of beer.\n" << "Take one down, pass it around, " << i << " bottle of beer on the wall."; } } is basically the same thing as the L++ version, with a few added bitshift operators.
- ktg 12y agov0.2: Macros are supported via Racket's macro system define-syntax.
- cjensen 12y agoSilly Parens are easier to parse. Automated manipulation of programs might be fairly easy to accomplish. If there were Lisp-style Macros available, that would beat the pants off the C Preprocessor for boilerplate.
- NAFV_P 12y ago> Silly Parens are easier to parse. I thought silly parentheses are just as easy to parse as in an imperative language like C. Are you referring to the Polish prefix form being easy to parse?
- loumf 12y agoIt's more like, the text is easier to turn into an AST, and it's easier to manipulate that AST. It's not so much the parens, but the nested structure (and that all of the code is in that structure)
- NAFV_P 12y ago> It's not so much the parens, but the nested structure (and that all of the code is in that structure) I should have explained myself more clearly, I thought that the operator appearing at the beginning of the list means that operator precedence is no longer relevant. With infix operators the precedence is important.
- aerique 12y agoYes, this is also correct. In most (if not all) Lisps the generic structure is "(operator [arg1] [arg2] [...] [argn])".
- Crito 12y agoInfix languages are trivial to parse; undergrad CS students typically do it the same week that they learn about parsing prefix and postfix languages. What actually makes lisps easy to parse is a near complete absence of syntax; particularly structures/constructs that require considerable effort to disambiguate.
- jordigh 12y agoIt is indeed just C++ with lisp syntax. Talk about cargo culting.
- pmelendez 12y agoIt compiles to C++ but I wouldn't say that is C++ with a Lisp syntax. Just in the same way that CoffeeScript is not Javascript. In fact it uses Racket behind the scenes which might open the door to use regular Lisp features.
- jnbiche 12y agoJeremy Ashkenas, creator of CoffeeScript: "The golden rule of CoffeeScript is: 'It's just JavaScript'"