5 ms·
I'm currently browsing the list of languages made with racket (here http://docs.racket-lang.org/search/index.html?q=H%3A http://docs.racket-lang.org/search/inde
by bsaul 8y ago
I'm currently browsing the list of languages made with racket (here http://docs.racket-lang.org/search/index.html?q=H%3A http://docs.racket-lang.org/search/index.html?q=H%3A) and it seems like most languages are just lisp variants. I suppose they were made for educational or fun purposes, but i wonder if i haven't missed something more deep as to why someone would want to reimplement a lisp in a lisp language.
- cat199 8y agosemantics != syntax
- darkpuma 8y agoIt's not that those languages are "lisps", they just mostly use s-expressions. That's because the syntax isn't what they're trying to innovate on, or what they're trying to stand out with. And also because once you understand s-expressions, it becomes kind of hard to justify not using s-expressions. Honestly, why bother with novel syntax when your PL semantics can be expressed in terms of s-expressions?
- spdegabrielle 8y agoA sampler of languages is at https://docs.google.com/spreadsheets/d/1K4IbX0OH8pz1qebG5lIaQynFIFAO2vqBA8EuCClRSSI https://docs.google.com/spreadsheets/d/1K4IbX0OH8pz1qebG5lIa...
- jellybellys 8y ago2 reasons: 1. Lispers often find s-expression syntax easier to edit for many applications. So it's not surprising that a lot of the folks who design languages in Racket also might choose an s-expression syntax for their language design. 2. By using the same (or similar, in the case of Pollen/Scribble/...) syntax as the main racket language, it's easy to give access to the full power of racket in a DSL.
- e12e 8y agoI'd say most are racket variants - and that makes sense - the scribble lang (for documentation/documents) is a prime example of that kind of "tool" DSL, and "lazy" (as mentioned by another commenter) is another. https://docs.racket-lang.org/scribble/getting-started.html https://docs.racket-lang.org/scribble/getting-started.html But there's also stuff like: http://docs.racket-lang.org/sweet/index.html http://docs.racket-lang.org/sweet/index.html And after a quick Google I found: https://github.com/soegaard/minipascal https://github.com/soegaard/minipascal And there are of course things like: https://docs.racket-lang.org/datalog/datalog.html https://docs.racket-lang.org/datalog/datalog.html But I suppose that qualifiés as "lisp like"... [ed: and the article mentions "brag" which I think would be odd to call "lisp like" : https://docs.racket-lang.org/datalog/datalog.html https://docs.racket-lang.org/datalog/datalog.html ]
- tjoff 8y agoIsn't it also done in SICP? So lisp users probably have that in mind when trying it out in racket.
- adjkant 8y agoRacket tends to be geared to writing lispy things because of the heavy reliance of the syntax parsing and macro transformation on s-expressions, so most/all being variants of lisp makes sense. Writing non-sexp languages in Racket tends to take a lot more work that's not batteries included. It also has an incredibly powerful inheritance system. In 3-5 lines I can inherit all the functionality from Racket and then add, modify, or delete any part I like. Reminder, I can do all this from the compile time level, not the runtime level. I can change something as basic as how you define functions with just a few lines of code while still getting everything else. Basically, I can easily write Racket+X or Racket with modified Y or Racket without Z and make it it's own entire language with very minimal effort. A lot of this occurs because of Racket's insanely good macro system. You can also use these tools in libraries/packages and still get the compile time control while the language is still officially Racket.
- spdegabrielle 8y ago> Writing non-sexp languages in Racket tends to take a lot more work that's not batteries included. No more work than any other language - Racket has reclusive descent, lex/yacc and PEG parsers generators. There is a whole section on parsers at http://docs.racket-lang.org/ http://docs.racket-lang.org/ including ‘Megaparsack’ based on higher-order parser combinators (like parsec for Haskell) Racket can also read ‘C’ yacc/bison grammars. It’s worth noting that a variety of non-Lisp-parenthesis-languages have been done in Racket including Java and Python.
- gus_massa 8y agoThis looks like a nice topic for a blog post / single page tutorial. Perhaps show the rackety way and compare with version in Racket that use the usual parsers in other languages.
- mpweiher 8y agoThat was my impression as well: you can have any language, as long as it's LISP. Some of the more specialised languages are different, though.
- krapp 8y ago> you can have any language, as long as it's LISP. Let's be fair, many lisp programmers would be perfectly fine with that.
- bsaul 8y agook but then since lisp already has an extremely small syntax, why not simply define functions in the language rather than using the macro system ? Unless your goal is to be source compatible with another lisp variant, of course.
- krapp 8y ago>why not simply define functions in the language rather than using the macro system? I don't know. Most examples I've seen from people extolling the virtues of lisp macros and metaprogramming wind up just generating more lisp code in the same language with the same syntax and semantics, so I don't know why you couldn't just use functions in that case. To be fair, I only have a surface understanding of one lisp variant (Arc) so it's entirely likely I just don't get it.
- Bogdanp 8y agoSyntax is different from semantics. To give a concrete example, say you want a part of a program to use lazy constructs. In racket, you could use `#lang lazy` for that one module and then import and use that code within `#lang racket` modules. Despite having the same syntax, `#lang lazy` and `#lang racket` behave differently: #lang lazy (define (say-hi _) (displayln "Hi!")) (say-hi (exit 1)) $ racket lazy-example.rkt Hi! $ echo $? 0 versus #lang racket (define (say-hi _) (displayln "Hi!")) (say-hi (exit 1)) $ racket racket-example.rkt $ echo $? 1 Exact same syntax, different semantics.
- earthicus 8y agoI don't see it on that list, but there's apparently an implementation of Algol 60 baked into dr racket, so you need not limit yourself to lisps if you want to put in the work to do something more far-reaching. https://docs.racket-lang.org/algol60/index.html https://docs.racket-lang.org/algol60/index.html https://github.com/racket/algol60 https://github.com/racket/algol60