4 ms·
Got a couple of questions - what's that IDE like, and how's Racket compared to Clojure? I'm a newb to the paradigm, but fiding it useful to understand Javascri
by barrenko 5y ago
Got a couple of questions - what's that IDE like, and how's Racket compared to Clojure?
I'm a newb to the paradigm, but fiding it useful to understand Javascript better.
Thanks.
- gus_massa 5y agoHere is an screenshot of the IDE and more info https://docs.racket-lang.org/drracket/interface-essentials.html https://docs.racket-lang.org/drracket/interface-essentials.h... It includes syntax highlight (that is difficult because you can add your own syntax), online help, debugging, debugging of macros (that are the way to add your own syntax).
- iamevn 5y agoIt's not the most advanced IDE but it's good enough that I almost always use it when writing in Racket. Pretty much everything in the editor is set up so that languages implemented in Racket automatically get to take advantage of it which is really cool. The repl is about on par with readline but with fancier output. Stuff like images and what racket calls "snips" are directly displayed in the repl. Snips implement their own rendering and interaction handling so you can do stuff like animation, plot charts, display an interactive map, etc. What I feel like it's missing is a way to collapse output/results like the console in firefox/chrome does and a way to reference the previous results (beyond just hitting the ctrl+up keybind) like in ipython. There's a solid debugger and a tool to show each step of macro expansion if you need that while writing macros. Package manager is integrated into the editor. Autocomplete, syntax highlighting, auto indent/reinvent are all present and are fine. It's got a bunch of little nice things like when you mouse over an identifier it draws an arrow to the where it was bound or required from a module. The reverse works too so you mouse over a binding/require and get arrows showing all the occurences. Another little thing is that it will automatically input the correct closing paren depending on context so if you're typing "(foo [bar (baz" and you then type ")" three times it'll input ")])".
- jnxx 5y agoWhat I find very nice with the IDE is that it can directly display images as function results. That's useful for teaching but I think it might also be very handy for data visualization and symbolic representations. Perhaps even for debugging with complex data structures. I think this is a mayor innovation.
- jnxx 5y agoI can't talk about IDEs because I use Emacs for both languages, and it works well for me. Clojure and Racket have quite a few similarities. They are both relatively minimal, and are both Lisp-1 (https://clojure.org/reference/lisps https://clojure.org/reference/lisps). Racket as a Scheme has a stronger separation between compilation and run time, in order to maintain safe semantics. This has an effect on interactivity which is an important difference between Schemes and Lisps. It is easy to redefine a function in a running Clojure program and call into it without re-starting the whole program. In Racket, one does more often re-start a program. Clojure is heavily opinionated towards functional programming. For example, all sequences are evaluated lazy, while Schemes do not do that by default. This is something it has in common with Haskell. But I also think this might be one of its many adaptations for use as a language in server and back-end environments, where sequences can become very large. These adaptations make Clojure very good for concurrency but less well-suited for true parallelism. It generates also slower code than Common Lisp. Clojures standard implementation is tied to the Java virtual machine. This has advantages and disadvantages: A very large library of functions which programs can call into. Worse stack traces. Error reporting is limited in comparison to Common Lisp. No continuations like in Scheme. And it is much harder to call into C code when this is needed for speed, for for calling into system functions. In Racket, it is easy to call into C code and to call into Rust code with C ABI. That means Racket can be used as a glue language, like Python (however it is not made for being embedded into C/C++ programs, that would be a flagship application for Guile). Clojure programs have a large start-up time of potentially several seconds which is irrelevant for servers, but make int unsuitable for scripting (well, there is babashka, a Clojure implementation which improves on that https://github.com/babashka/babashka https://github.com/babashka/babashka). All in all, Clojure is fantastic for programming for the server and for concurrent tasks, and for learning functional programming. Racket on the other hand is well suited for beginners, it has a large and well-rounded standard library and a lot of useful packages. It is easy to write a GUI with it, it is good for easy scripting, interacting with the OS, writing experimental algorithms, like Python very suitable as glue and so on. Also, because Racket belongs to the Scheme family, if needed there is a whole host of Scheme implementations which can be used for any special needs, with very little change in the base language, so in that way Racket is one versatile power tool in a quite large tool shop. There are also applications where I think Common Lisp is probably the best choice: Very mature implementations, very stable, availability of compilers which generate very fast code, especially a high performance in numerical algorithms, good imperative capabilities where they are needed, fastest start-up for scripts, very good documentation and books, independence from particular vendors or projects.