1. 26
    1. 6

      The second best programming language!

      1. 2

        What do you mean?

        1. 3

          Just a joke. Obviously the best one is your favourite. 😀

          1. 11

            the best one is clearly the one you use racket to build (:

          2. 2

            Oh, okay :) I thought it was some kind of a reference!

    2. 2

      I’ve been using Racket as an R6RS target in https://github.com/mk12/sicp. It seems like a really cool language, and I find the “language-oriented programming” idea from Beautiful Racket intriguing. But the installation process and tooling is a buzzkill for me. On macOS, there are two main options:

      1. brew install --cask racket. This pulls in the whole kitchen sink, littering my Applications directory with a host of apps I’m never going to use, including DrRacket but also launchers for documentation, slideshows (?). It reminds me (in a bad way) of installing MacTeX. DrRacket feels like an educational toy, like the Processing/Arduino IDE: not something I’d use for a large project. For all other languages I’m happily living in the VS Code era with high quality LSP-based extensions.

      2. brew install minimal-racket. Just the barebones CLI, this is what I wanted! Oh, but it’s really minimal, so I need to raco pkg install r6rs. It prompts me for every single dependency unless I pass --auto … strange. And why on earth is it downloading scribble and dozens of other things? Oh, maybe I need --no-docs? Nope, it still wants to download them all. Turns out I want r6rs-lib. Then to compile a project I need to use raco make, but that subcommand doesn’t exist until I raco pkg install make. This time I can’t figure out a way to stop it from smuggling in all these GUI packages I clearly don’t need. So I wait for several minutes on my M1 Pro machine until it finishes. The CLI for racket/raco reminds me (in a bad way) of autotools or cpan.

      Maybe I’m just spoiled by Go/Rust/etc. but polishing the tooling would go a long way for me.

      1. 6
        1. I use DrRacket for professional development on large projects. Of course, you can do it differently but it’s widely used in the Racket community.
        2. You can press a to answer yes to all subsequent installation prompts.
        3. raco pkg install r6rs installs documentation because the r6rs package depends on the r6rs-doc package. The --no-docs flag doesn’t build the documentation, but does install it.
        4. The raco make command is in compiler-lib, not in the make package (which is a build system).

        In general, the things you have run into are not about the tooling per se, but about what is in what package, and the fact that Racket provides extensive local documentation for everything.

        1. 3

          Thanks, that’s good to know about compiler-lib. Is there some way I could have discovered that on my own? It would be nice if it was mentioned on https://docs.racket-lang.org/raco/make.html.

          1. 2

            I agree, I think including that on those documentation pages would be a good idea.

      2. 3

        The official installers for macOS are here: download.racket-lang.org

        ad 1. The official installer gives you a single folder in /Applications/Racket version-number/ so with the official installer there is no problems with littering Applications.

        ad 2. The --no-docs situation is a but tricky. Some package have separate collections for the main library and for the documentation. In that case --no-docs work as expected. However, some collections use only one collection for both. That is, there is no way to install that package without automatically installing its documentation. If you see this, the best thing to do is to gently ask the developer of the package to split his package in two parts.

        I recommend to get the full official installer. Unless we are talking deployment on, say, a web server.

        1. 2

          Homebrew just wraps the official installers. It put them in that folder but in Launchpad they’re all spread out and I have to hide them. The whole “install many little GUI apps for various tasks” gives me vibes of old software not tailored to macOS. That’s what pushed me to minimal-racket, the same way I prefer brew install python rather than running the official .pkg which assumes I want IDLE etc.

          I see, thanks for explaining about --no-docs. I guess it’s nice if Racket encourages thoughtful documentation (unlike stereotypical Haskell for instance). However, as a newcomer, having raco pkg install take forever because of documentation feels like a strange problem that I’ve never encountered in any other system. If it’s typical for documentation to need so much machinery to build, it seems there ought to be a separate set of “doc dependencies” similar to how most package managers have separate “dev dependencies”.

          1. 2

            I’ll be honest - I never use Launchpad, so I have no idea what the “standard practice” is here. Bring it up on https://racket.discourse.group/ and see whether the community agrees.

      3. 3

        I don’t know who does the brew installers. AFAIK they are not part of the release testing process.

        I never have any trouble with either either the official installers at https://download.racket-lang.org/ or building from source on macOS or linux. They are clean and easy to uninstall, putting everything into a single folder.

        If you are working through SICP them I’d suggest you use #lang sicp - you do need to install it with raco pkg install sicp, but it provides a variant of R5RS that matches SICP. (it also includes the picture language from SICP)

        FWIW R5RS and R6RS are included when you use the full racket installer (not minimal), a community member has also released R7RS. I don’t use any of the scheme implementations as I’m more interested in the Racket language and Typed Racket.

        If you don’t want to use DrRacket you don’t have to; you can use VScode. Try the ‘Magic Racket’ VSCode plugin.

        My personal opinion is while Dr Racket has capabilities that other environments don’t have, if you are learning you will probably be happier using an editor you already know.

        If you want the official ‘minimal’ install you can get it at https://download.racket-lang.org/releases/8.5/

        • The minimal installers include “just enough of Racket that you can use raco pkg to install more”, but my recommendation would be to use the full official installer until you are more familiar.

        It is big but you get a lot. Like MacTeX, I think it is worth it. 😀

        Racket isn’t Go or Rust. judge it for what it is, not what it isn’t.

        If you are new to Racket and have questions or need a hand getting started: Discourse and Discord are the most active places.

        We welcome questions 😃

        1. 1

          I appreciate your enthusiasm, and I apologize for being so ranty (wasn’t really thinking from the perspective of a Racket contributor). I think the bar for CLI tooling quality has gone up quite a bit in recent years. Maybe some of it is just changing fads, but there is definitely a trend towards more friendly, consistent, predictable, easy to use interfaces. These first impressions are important the same way having a nice looking website is. My gripe is mainly with raco. Compared to all the other package managers I’m used to — cargo, go, pip, gem, npm, yarn, elm — I found it disappointing. Why does raco pkg install make download 100+ packages, most of which seem to be for documentation or GUI, despite --no-docs? And why is the default to prompt y/n ~100 times?

          Racket may not be Go or Rust, but as general-purpose programming languages I think it’s fair to judge them against one another. And Racket isn’t unique here. I think Haskell’s package management is far worse, even with stack. And Clojure’s tooling and error messages leave a lot to be desired. All three are great languages but these things hold them back, at least for me. I want a language to be cool on paper and have all the boring stuff (installing packages, running tests, …) work delightfully. I know that’s a lot to ask 🙂

          As for #lang sicp, I’m trying to target as many R6RS compliant Schemes as possible, so Racket is just one of them. I chose R6RS because I was really impressed with Chez Scheme’s speed and wanted to primarily use it. Of course now Racket is now Racket CS so it’s less variety than I had before. I also support Guile.

          1. 1

            Racket may not be Go or Rust, but as general-purpose programming languages I think it’s fair to judge them against one another.

            Sorry forgot to respond to this.

            I think fair comparison is to use them as intended. This varies from language to language and with Racket I think it is fair to say you are intended to use the full (official) install.

          2. 1

            Why does raco pkg install make download 100+ packages, most of which seem to be for documentation or GUI, despite –no-docs? And why is the default to prompt y/n ~100 times?

            Sorry, I don’t know what dependencies #lang r6rs has so I’d suggest asking on the discourse server.

            As for #lang sicp, I’m trying to target as many R6RS compliant Schemes as possible, so Racket is just one of them. I chose R6RS because I was really impressed with Chez Scheme’s speed

            When you are using #lang r6rs you are using neither Racket nor Chez. Rackets r6rs is built on top of Racket which is in turn built on top of Chez.

            I think you can access the implementation of chez from the command line by identifying the binary, but if you want to support chez I’d use the definitive version as I believe racket uses a fork https://cisco.github.io/ChezScheme/ Chez is a superset of r6rs

            Racket the language isn’t a R6RS implementation. I think they had to change the name (11 years ago?) because calling it a scheme at that point had already become a problem https://racket-lang.org/new-name.html

            That said - thank you for making and sharing your R6RS SICP work.

            Will you eventually extend to include Common Lisp?

            I suppose the recently released SICP javascript edition opens the door to a similar exercise in other languages; C++, Java. I wonder how an SICP in Pharo, Ocaml, Forth, or Erlang would look.

            Bw Stephen

            (Edit - added SICP to ‘sharing your R6RS work’ to clarify meaning)

            1. 2

              You’re right, I’m not really using Racket the language. I wanted to avoid tying myself to a particular Scheme implementation by targeting one of the RNRS standards. And the best way to ensure I’m really sticking to the standard is to test with multiple independent implementations. Also I wanted to be able to use modules portably, so R5RS was out, and I couldn’t find enough cross-platform R7RS implementations. So R6RS it was.

              I think I’m operating in the spirit of Racket’s language-oriented programming though, in that my solutions are not written directly in R6RS but in a custom language that I implemented with macros.