1. 67
  1. 20

    I’ve been using Racket as my daily driver for 10 months at this point and I much prefer it to Python, which I had previously been using professionally for a decade. Everything is more well thought out and well integrated. The language is significantly faster, the runtime is evented and the concurrency primitives are based on Concurrent ML, which I find to be a nice model. There is support for real parallelism (in the same manner that Python 3 is going to support real parallellism in the future (one interpreter per system thread, communicating between them via channels))). I could go on and on. The overall the experience is just much, much nicer.

    The only real downsides are

    • the learning curve – there is a lot of documentation and a lot of concepts to learn coming from a language like Python – and
    • the lack of 3rd party libraries.

    To be honest, though, I don’t consider the latter that big of a deal. My approach is to simply write whatever library I need that isn’t available. I’ve released 11 such libraries for Racket in the past year, but I only invested about two weeks total working on all of them and the upside is they all behave in exactly the way I want them to. Part of the reason for that is that you can get shit done quickly in Racket (not unlike Python in that regard) and part of it is knowing what I want and exactly how to build it which comes with experience.

    EDIT: I just ran cloc over all of my racket projects (public and private) and it appears I’ve written over 70k sloc in Racket so I would say I’m way past the honeymoon phase.

    1. 14

      To be honest, though, I don’t consider [he lack of 3rd party libraries] that big of a deal. My approach is to simply write whatever library I need that isn’t available.

      I use Python almost exclusively for its ecosystem, and I imagine that’s pretty common. As much as I would love to reinvent the world, I don’t think that reimplementing numpy (for example) is ever going to be on my plate. But, for projects with limited needs for external libraries, there are certainly many better languages, and Racket’s a great one.

      1. 3

        the learning curve – there is a lot of documentation and a lot of concepts to learn coming from a language like Python

        I’ve been meaning to pick up Racket since a few weeks now. Also coming from a language like Python, are there any specific resources you would recommend?

        1. 12

          Racket’s documentation is excellent.

          1. 5

            I’ve been using a combination of the official guides, the reference and reading the source code for Racket itself and for whatever library I’m interested in using. I also learned a lot by joining the racket-users mailing list.

            If you’re like me, you might be used to skimming the Python documentation for the information that you need. I learned the hard way that it’s not a good idea to do that with Racket. You’ll often save time by just taking a few minutes to read and absorb the wall-of-text documentation you hit when you look up a particular thing than you are interested in.

            You might also find this blog post by Alex Harsányi useful.

            1. 2

              The have an official book that teaches both programming and Racket. Might be worth looking at.

          2. 12

            My brother who studies maths just took an exam for the programming course at his uni, which was taught in C using a terrible old IDE and seemed to mostly focus on undefined behavior, judging from the questions in the exam. The high school programming class was similar, from what he told me.

            I’m baffled that this is considered acceptable and even normal, and that Racket, with its beautiful IDE, its massive standard library and its abundance of introductory programming course material is not even considered. I know there’s a lot of understandable reasons for this, but it’s still so backwards.

            1. 8

              Ha! Yes. That reminds me how angry I used to get about mediocre, obsolete, industry-driven CS pedagogy as a student. I dealt with it in part by finding a prof who was willing to sponsor an independent study course (with one other CS student) where we worked through Felleisen’s How To Design Programs, using what was called Dr Scheme at the time. But eventually I gave up on CS as a major, and switched to Mathematics. Encountered some backwardness there too, but I’ve never regretted it – much better value for my time and money spent on higher ed. The computer trivia can always be picked up as needed, like everybody does anyway.

              From what I understand, my school now teaches the required intro CS courses in Python. This seems like a reasonable compromise to me, because average students can get entry-level Python jobs right out of school.

              1. 7

                As someone who has had to deal with a lot of code written by very smart non-computer-scientist academics, please be careful telling yourself things like “The computer trivia can always be picked up as needed”. Good design is neither trivial nor taught in mathematics classes.

                Usually isn’t taught in CS classes either, I confess, but the higher level ones i’ve experienced generally at least try.

                1. 3

                  I agree completely, and I actually took most of the upper-division CS courses that seemed genuinely valuable, even though they didn’t contribute to my graduation requirements after I switched. (The “software engineering” course was… disappointing.) But I’ve learned a ton about good engineering practices on the job, which is where I strongly suspect almost everybody actually learns them.

                  I currently deal with a lot of code written by very smart CS academics, and most of it is pretty poorly engineered too.

              2. 4

                Racket is used in the intro course at Northeastern University, where several of the developers are faculty, so there’s at least one place it’s possible to take that route. I think this might be either the only or one of the only major universities using a Lisp-related language in its intro course though. MIT used Scheme in its intro course for years, but switched to Python a few years ago.

                I haven’t been seeing much C at the intro level in years though (I don’t doubt it’s used, just not in the corners of academia I’ve been in). We use Python where I teach, and I think that’s overwhelmingly becoming the norm. C is used here only in the Operating Systems class. When I was a CS undergrad in the early 2000s, seemingly everywhere used Java.

                1. 3

                  Sounds like the exam was designed to teach the sorts of things he’ll be asked in programming interviews. Now he has great “fundamentals”!

                  1. 3

                    Same here. Professors suck at my university, which happens to be one of the top universities in China (It’s sponsored by Project 985). Our C++ exams are mostly about undefined behaviors from an infamous but widespread textbook, the SQL course still teaches SQL Server 2008 which has reached its EoL over 5 years ago and cannot be installed on a MacBook, and it’s mandatory to learn SAS the Legendary Enterprise Programming Language (mostly SAS is used in legacy software). Well, I’m cool with it because I’m a fair self-learner, but many of my fellows are not.

                    I have a feeling that the professors are not really into teaching, and maybe they don’t care about the undergraduates at all. Spending time on publishing more papers for themselves is probably more rewarding than picking up some shiny “new technologies” which can benefit their students. I guess they would be more willing to tutor graduate students which can help to build their academic career.

                    1. 1

                      Our first three programming courses were also in C (first two general intro, the third one was intro to algorithms and data structures). After that, there was a C++ course. This is the first time I had an academic introduction to C++–I already knew it was a beast from personal use, but seeing it laid out in front of me in a few months of intense study really drove the point home. I was told this was the first year they were using C++11 (!)

                      Programming education in math departments seems to be aimed at making future math people hate it (and judging by my friends they’ve quite succeeded, literally everyone I ask says they’re relieved that they “never have to do any programming again”).

                      1. 2

                        Programming education in math departments seems to be aimed at making future math people hate it

                        Exactly! I can’t imagine how somebody with no background in programming would enjoy being subjected to C, let alone learn anything useful from such bad courses, especially at university age.

                        1. 2

                          I thought C was awesome when university gave us a 6-week crash course in it, we had to program these little car robots.

                          1. 4

                            “6-week crash course in it” “program these little car robots.”

                            The choice of words is interesting given all the automotive C and self-driving cars. Is it your past or something prophetic you’re talking about?

                    2. 5

                      One of the main reasons I don’t actually use a Lisp for much of anything is that Python does most of the things I would want from it. So, maybe it’s time to turn that around and see how it goes!

                      1. 2

                        You could indeed try turning it around, because for me Common Lisp does most of the things I want from it :-)

                        The devil is in “the thing I want from it” ofcourse, which is different for everyone and I assume for a lot of people the Common Lisp ecosystem might be lacking.

                        1. 1

                          I’m kind of a beginner with Common Lisp, and really experienced with Python. So I’m at a place where I use Python when it’s actually important for me to churn something out, and Common Lisp when I want to have lots of fun playing around.

                        2. 2

                          “it even comes with a built-in game engine for kids”

                          Can you (or anyone) provide more info? I wasn’t able to find it with some quick Googling .

                          1. 3

                            Yes, sorry I should have linked it originally! The link is fixed now. It’s big-bang/universe. Realm of Racket is a good book for teaching how to program by building games (sadly its not libre documentation, but it is good)

                          2. 2

                            For those that like the semantic indentation, there is also the sweet expression syntax.

                            1. 0

                              In the era of clusterfsck of dozens of different platforms, creating a language which can’t easily produce a dependency-free binary which can run on customers machine without any sort of additional effort in runtime bring up (even an “installation”) can’t be called “acceptable”.

                              The same goes for Python, except its interpreter is by default available on all of three major desktop platforms since last month (thanks Microsoft) at least until next major macOS release (thanks Apple!).

                              1. 19

                                While it’s true that Racket can’t produce a single statically-linked binary for your program (assuming that’s what you mean by a dependency-free binary), it can certainly produce a self-contained distribution of your program by packing your program and the Racket runtime into a single executable along with all of its dependencies. This is how I distribute all of my web application and it works out nicely.



                                1. 2

                                  Do you have any end-to-end examples that you can share of using these tools to build a self-contained web app?

                                  Thanks! either way (the links are a good start!)!

                                  1. 12

                                    It really doesn’t take much beyond having an app with a main submodule as its entrypoint and then running

                                    raco exe -o app main.rkt

                                    followed by

                                    raco distribute dist app

                                    Any libraries referenced by any of the modules in the app as well as any files referenced with define-runtime-path will automatically be copied into the distribution and their paths updated for the runtime code (no need for any special configuration files (and, especially, no need for a MANIFEST.in, which, if you’ve ever tried to do this with Python you might know is a horrible experience)).

                                    For Linux distributions (since I am on macOS), I run the same process inside Docker (in CI) to produce a distribution. Here are my test-app.sh and build-app.sh scripts for one of my applications:

                                    The raco koyo dist line you see in the second file is just a combination of the two commands (exe and distribute). In fact, if you want to give this a go yourself, then you can use my yet-to-be-fully-documented koyo library to create a basic webapp from a template and then create a distribution for it:

                                    $ raco pkg install koyo
                                    $ raco koyo new example  # think "rails new" or "django startproject"
                                    $ cd example
                                    $ less README.md  # optional
                                    $ raco koyo dist
                                    $ ./dist/bin/example  # to run the app

                                    Hope that helps!

                                    P.S.: Here is the implementation for koyo dist and here is the blueprint (template) that is used when you run raco koyo new.

                                    1. 2

                                      Thanks, this was just the kind of example I was hoping for.

                                2. 4

                                  can’t be called “acceptable”.

                                  To you, of course. Even the go nerds moved on to docker for deployments, you should consider it - I use docker for python codebases to manage things without needing to remember the exact invocation of venv, pip, etc.

                                  However, for me raco exe has been more than enough. Have you tried it?


                                  1. 7

                                    [edit, spell roost correctly]

                                    I’m not sure which go nerds you’re referring to. Perhaps I’m the exception that proves the rule, or perhaps the go community’s more diverse than you’ve seen. I love the fact that terraform, hugo, direnv, and a big handful of my other tools (large and small) are simple single file executables (ok, terraform is bigger than that, but…). It’s one of the things that attracts me to the language.

                                    I’m burnt out on solving a problem at build time and then having to solve it again each time I install an application (PERL5LIB, PYTHONPATH, LD_LIBRARY_PATH, sigh…). Thank goodness for Spack for my work deployments.

                                    I’ve found Docker to be useful in the small (”I use Docker on my laptop to X, Y, and Z.”) and in the big (”We have an IT team that wrangles our Docker hosting servers.”). For the stuff in the middle (”Dammit Jim, I’m a bioinformatician, not a syadmin!”) it turns into a problem on its own.

                                    If you know how to use venv, pip, and etc to build the Docker image, you could use them to do the deployment (though not for free…). I’ve seen many situations where people didn’t understand the Python tool chain but could hide the mess from review, at least until it came home to roose roost.

                                    1. 5

                                      I agree with you. I build lots of tiny, glue-style Go tools (mostly for my coworkers on my ops team), and somebody always ends up contributing a Dockerfile.

                                      I still prefer

                                      ./ldap_util --validate user1


                                      docker run --rm -it ldap_util:latest -e "USER_TO_VALIDATE=user1"
                                      1. 1

                                        I just think of docker images as universal server executables, which makes it easier to accept docker as a whole.

                                      2. 2

                                        I don’t think it’s bad that they have executables, but installing racket is very simple, and most of your complaints are actually places where python & perl are much worse than racket.

                                        This all sounds like you haven’t tried racket, and tried to rag on a general complaint where in racket it’s not nearly the same problem, and you haven’t worked with it or researched it.

                                        1. 1

                                          I think that you’re replying to my grumpy comments above….

                                          Most of that grumpiness was meant to be targeted at Docker and the anti-pattern of using it to hide a mess rather than clean the mess up; I’ve spent a lot of time (though it has earned me a fair bit of income) cleaning up problems downstream of Docker solutions. I made a similar comment somewhere else here on Lobste.rs that sums up my feelings; I’ve seen Docker used effectively in the small (e.g. on individual machines) and in the large (sites with savvy teams and resources to invest in keeping everything Docker-related happy) but the middle seems to run into problems.

                                          Other than the grumpiness above, I really don’t mean to rag on Racket, I’ve seen some neat things built with it (e..g Pollen).

                                          You’re right that I haven’t spent much time with racket; and big part of that is burnout with installing things that require finding and installing dependencies at “install-time”.

                                          I’m excited by @bodgans nicely packaged demo of distribute earlier in the thread.

                                          Are there any examples of tools written in racket (or it’s various sub-languages) that have been packaged up for installation by tools like Homebrew or Spack or …?

                                  2. 1

                                    What is the deployment story for Racket like, for servers, web, wasm, mobile, terminal and desktop?