3 ms·
First thing is to get rid of the syntax feeling unfamiliar. As a beginner, you need 3-4 chapters of a book for this. As an experienced dev, what you need is an
by klibertp 8y ago
First thing is to get rid of the syntax feeling unfamiliar. As a beginner, you need 3-4 chapters of a book for this. As an experienced dev, what you need is an overview, a cheatsheet, and reference docs.
I think you can get an overview from the Wikipedia on S-expressions[1], then there's Dylan cheatsheet[2] which translates Scheme syntax into equivalent forms in a language with more "normal" (infix) syntax, which also happens to be object oriented, so it should feel quite familiar(EDIT: thinking about it some more, maybe Dylan is still a bit too far from Algol-like syntax, but I can't find such right now). Then, there's Racket cheatsheet[3], and the Racket Tutorial[4]. After writing some Hello Worlds and getting familiar with the syntax, start branching into interesting libraries (like plot, pict; see the list on [5] or search on [6]). See `raco pkg` docs[7] for installing additional libs.
Advice about editor: find an S-exp support plugin for your editor and just go with that until you want some graphics support, in which case try DrRacket. Advice about weird things: try not to focus on weird things which are historical incidents - you can learn why CAR and CDR are called that way later, just remember that they are first/rest operations on lists.
After this I think Beautiful Racket along with the rest of the Racket docs should be enough to learn most of it. You can also skim How to Design Programs (linked at the end of tutorial) for intro to contracts.
[1] https://en.wikipedia.org/wiki/S-expression https://en.wikipedia.org/wiki/S-expression
[2] https://opendylan.org/documentation/cheatsheets/scheme.html#syntax https://opendylan.org/documentation/cheatsheets/scheme.html#...
[3] https://docs.racket-lang.org/racket-cheat/index.html https://docs.racket-lang.org/racket-cheat/index.html
[4] https://docs.racket-lang.org/quick/index.html https://docs.racket-lang.org/quick/index.html
[5] https://docs.racket-lang.org/ https://docs.racket-lang.org/
[6] http://pkgs.racket-lang.org/ http://pkgs.racket-lang.org/
[7] https://docs.racket-lang.org/raco/index.html https://docs.racket-lang.org/raco/index.html
- chriswarbo 8y agoRegarding s-expressions, there are some perfectly reasonable alternatives ( http://chriswarbo.net/blog/2017-08-29-s_expressions.html http://chriswarbo.net/blog/2017-08-29-s_expressions.html ) For example: https://docs.racket-lang.org/sweet/index.html https://docs.racket-lang.org/sweet/index.html https://www.draketo.de/proj/wisp/ https://www.draketo.de/proj/wisp/ Although I prefer to embrace the s-expressions :)
- klibertp 8y agoYeah, but that's not Racket (technically, the first one is, but it overrides the reader; the second is a Python-based transpiler of some syntax into S-exps) - it won't help someone new to the language, if only because it adds yet another dependency and mental conversion to keep in mind when reading examples and such. They're there if you want them, though.
- chriswarbo 8y agoWisp seems to override the reader too (so no transpiler needed) https://www.draketo.de/proj/wisp/src/94bae1032ef07e441a942c5881bb00963f27841a/racket/parse.rkt.html https://www.draketo.de/proj/wisp/src/94bae1032ef07e441a942c5... I agree about the extra dependency and indirection; although the syntaxes (syntaxen?) are equivalent, so examples can be translated automatically if copy/pasted. > They're there if you want them, though. Yep, although as I wrote on my blog: "Whilst the parenthesis-heavy format of s-expressions is not necessary, it usually crops up in anything discussing Lisp and its derivatives, simply because it's much more popular than these alternatives. To me, that mostly indicates that concerns about "too many parentheses" are really a non-issue, despite being made by many who are new to the format."
- klibertp 8y agoVery well said, and a good post, BTW. I have something similar, from when I started working with Clojure: https://klibert.pl/posts/tools_for_lisp_syntax.html https://klibert.pl/posts/tools_for_lisp_syntax.html