4 ms·
I've been vaguely aware of Racket, but I haven't paid much attention to the details. If I'm reasonably familiar with Common Lisp, what are the main differences
by waterlesscloud 12y ago
I've been vaguely aware of Racket, but I haven't paid much attention to the details.
If I'm reasonably familiar with Common Lisp, what are the main differences/advantages of Racket to pay attention to? What's the best resource (preferably online) to use to learn about Racket?
- mkozlows 12y agoRacket was PLT Scheme before they renamed it, so it's got a very academic focus, documentation focuses on the DrRacket (formerly DrScheme) IDE, and it's got a kind of old-school Lisp feel. Their documentation is great, though, so it's a good place to start: http://docs.racket-lang.org/ http://docs.racket-lang.org/
- orthecreedence 12y agoI think the main difference is that Racket is a Scheme, and Common Lisp is, well, Common Lisp. Racket has some great tooling like their IDE (Dr Racket, already mentioned). Really it comes down to the old CL vs scheme thing, which seems to boil down to "has almost everything you need already but is huge" vs "lets you build anything you need yourself and is tiny." However, I think this is less so with Racket because, while I haven't used it much, from what I know it's more of a batteries-included scheme used for Getting Shit Done (and does a good job of this). If I was going to use a scheme and I didn't have the requirement of needing to embed it, I'd probably go with Racket.
- deleted 12y ago[deleted]
- e12e 12y agoOther than what's been mentioned by others, Racket also comes with a nice way of bundeling up different languages/dialects (like typed racket for a strongly typed variant). See eg: http://docs.racket-lang.org/scribble/ http://docs.racket-lang.org/scribble/ I suppose it isn't technically such a different thing from other lisps, but like most of Racket -- it's pretty well thought out, and actually works really well. [ed: as per my other comment, see also eg: http://pkg-build.racket-lang.org/doc/sweet/index.html http://pkg-build.racket-lang.org/doc/sweet/index.html ]
- jpolitz 12y agoTwo things spring to mind, there are lots more I'm sure. Racket's macros are unlike any other. They are better thought of as a lightweight compiler API. Check out http://www.greghendershott.com/fear-of-macros/ http://www.greghendershott.com/fear-of-macros/. Also, the whole #lang framework is a pretty unique tool for experimenting with and extending the language, see http://docs.racket-lang.org/guide/hash-languages.html http://docs.racket-lang.org/guide/hash-languages.html. For example, used to build http://www.greghendershott.com/rackjure/ http://www.greghendershott.com/rackjure/. Greg Hendershott does some great writeups, there's more to find on his site.
- ethagnawl 12y ago> What's the best resource (preferably online) to use to learn about Racket? You could work through SICP using Racket instead of MIT/GNU Scheme. I'm currently in the midst of this and the differences thus far have been relatively minor (e.g. Racket doesn't have `inc`, `dec` or `nil`).
- dghf 12y ago> e.g. Racket doesn't have `inc`, `dec` or `nil` I'm assuming those are trivial to add?
- JimmyM 12y agoYeah, you could add 'nil' easily. inc and dec I assume mean increment or decrement (I have no experience with CL) - racket/base includes (add1 .) and (sub1 .) for the same effect. If they didn't exist they would be trivial to add I think - if this isn't what inc and dec mean then I apologise. In Scheme/Racket truth and falsity is really simple - #f is false and everything else is truthy. There's also already a null value for the empty list (which is 'true'). I don't know if nil would be useful.
- dghf 12y agoAnd it looks like someone's already done it: http://planet.racket-lang.org/package-source/neil/sicp.plt/1/13/main.ss http://planet.racket-lang.org/package-source/neil/sicp.plt/1...
- JimmyM 12y agoI dunno it looks to me like they've just defined nil to be equal to null/empty, which is not exactly the same. In Common Lisp, unlike Scheme/Racket, nil is the null value AND the false value. In Scheme/Racket, 'nil is true unless you define it to be #f. If you wrote an if or cond expression to evaluate the 'nil in the link, I think that it would return true, whereas in CL nil is falsy (I think it is the only falsy value in CL, but I would still describe it as 'falsy' rather than false, possibly incorrectly). e: Ah, I see why I'm not understanding you now - you're talking about the differences between Racket and SICP/Scheme whereas I made the assumption that we were talking about the difference between Common Lisp and Racket (from OP's comment). To further clarify, I believe this was my fault in comprehension, not yours in communication.
- PuercoPop 12y agoAs other have said, Racket is a 'batteries included' scheme. The two things I miss from CL are CLOS (and no, tinyCLOS doesn't count) and loop/format. Their pattern matching is easier to extend than optima though.
- jbclements 12y agoyou might be interested in http://try-racket.org http://try-racket.org . Quick online tutorial. Haven't worked through it myself, but spent 30 seconds with it to make sure I wasn't embarrassingly wrong.
- JimmyM 12y agoI've enjoyed the following resources: SICP - http://mitpress.mit.edu/sicp/ http://mitpress.mit.edu/sicp/ HTDP - http://htdp.org/ http://htdp.org/ Dan Grossman's Programming Languages Coursera course - https://www.coursera.org/course/proglang https://www.coursera.org/course/proglang The Racket docs - http://docs.racket-lang.org/ http://docs.racket-lang.org/ Chris Jester-Young's StackOverflow answers - http://stackoverflow.com/search?q=user:13+[racket] http://stackoverflow.com/search?q=user:13+[racket] This list won't be as useful to you as it was to me, because you already know Common Lisp, but hopefully other readers will find it interesting. NB - the ProgLang Coursera course features Racket alongside SML, Ruby and quite a lot of material that will seem very basic to experienced programmers, but it's a really good introduction of some of its key features. I think this is probably my weakest recommendation to someone who already knows Common Lisp (or similar) and my strongest recommendation to someone who does not. Beyond that, the default DrRacket IDE comes with a whole load of teaching resources bundled by default, including (iirc) resources to help build a game in Racket - this package I think http://docs.racket-lang.org/teachpack/2htdpuniverse.html http://docs.racket-lang.org/teachpack/2htdpuniverse.html. As for differences/advantages of Racket, I would say that there are few that I'm aware of beyond the simplicity of learning the language, the great tools, and the ease with which you can get up and running. Nothing inherent to the language that I'm aware of, and I would suspect that Common Lisp is great if you're already part of that community and 'know where everything is' so-to-speak. I've heard that CLOS is better than Racket's OOP abilities. I really do love the language, though, it's one of the easiest and most joyful experiences I've ever had with a programming language. Just maybe not a necessity if you already know CL.