Experiences coming from other languages to Racket?

Disclaimer
Wall of text incoming. I love Racket. It is the Programming language I know the best after Python. This experience is my own, and a lot of what follows below could be described as me issues

Which language(s) were you coming from? (if relevant)
My background is a biology major with a Masters in Bioinformatics. I learned to program in Python during my masters in my early twenties and I picked up Emacs as my text editor of choice. This is the perspective of someone who is working as a data scientist, was not a CS major, and had only 1-2 years of programming experience at the time that they learned about Racket.

Emacs (like it has been for so many others) was my gateway to Lisps. Unfortunately I found it a little to difficult for me to learn at the time so I started looking for something else. I had heard about Common Lisp so I tried to learn that. I picked up Clisp initially and worked through Land of Lisp (I like games!) but fell off after awhile. I played around with other Lisps for awhile, SBCL, Guile, Chicken etc. I eventually found the How to Code Simple Data course on edX with Gregor Kiczales in Racket. It was a gentle enough introduction that after a doing a few modules, I finally felt like I was grasping Lisp. I also felt like I was learning some good design principles for programs in general. Since then, I've used it on and off for the past 4 years, but I've picked it back up in earnest after 8.0 and the full transition to Racket on Chez.

What surprised you when you came to Racket?

  1. The documentation was very good. Having learned Python, there were always people around me I could ask for help, or great YouTube videos I could watch. I almost never had to learn to read documentation to figure out how things were done. I was initially intimidated by it when I would see all the annotations for a function (number? pair? is-a? frame%)? I still don't always understand it, but I find it much more readable now that I did a year ago.

  2. It runs on so many things! M1 macs, Linux, Windows, with pre-compiled binaries. The only other Lisp I've had an easy time getting set up on multiple OSes was SBCL.

  3. It's got a gui in its standard lib, and I sort of understand it. I've always been interested in writing native desktop apps, and I've been able to write a few simple ones in Racket. Also MrEd for a wysiwyg gui editor

  4. There is a discord. This has been game changing for me. I never had much success getting answers on the freenode chat (pre libera chat debacle) and the last two times I've used the libera chat no one has responded. But the Discord has been super helpful and is very active. I don't have any Racket mentors locally so it's nice to be able to talk to people about Racket, or ask questions.

  5. PasteRacket (it's awesome)

  6. The tooling. Scribble, Raco, Frog. You can create an entire pipeline from the documentation to showing off your programs on your blog all in Racket.

What was confusing and unfamiliar ?

  1. I would google for a function, I would click the link to the docs, and there was no example. As someone who was still relatively new to programming and dipping their toes into Lisp, I would immediately feel lost after this.

  2. A lot of Racket documentation is very academic. I understand that the reference is supposed to be much more technical, but as a beginner, when the guide doesn't have the examples you need and the reference is a wall of text, it's super intimidating. I never learned BNF, Sometimes I feel like I need a PhD in programming language dev to understand it, or that I'm just not smart enough to ever get it, or that I need a reference for how the reference is written, and what concepts I need to know before it will be accessible to me. I'm just some guy who likes to program small stuff in there spare time, I'm not even sure I can call myself a programmer since most of my work work is just scripts and data munging and stuff. I don't have the credentials of some of the awesome people I see steering the project, and making cool stuff, and it leaves me with self doubt sometimes.

  3. The module system/importing exporting (are they the same thing?). As I've been exploring other peoples libraries and code I'm starting so see a lot more things like (require prefix-in, or for-syntax rename-out), it makes things behave in ways I'm not used to and confuses me sometimes.

  4. Language oriented Programming/macros. I've been using Racket on and off and I'm ashamed that I never have created a DSL, or written a macro for any of the code I write.
    For Macros my issues are...

  5. I've never written a large enough program to feel like I've needed them

  6. I don't have enough experience with them to go "Oh here is a good place to make a macro"

For LOP my issues are...

  1. I don't have a PhD in programming language development, so how can I expect to come up with a good one or even know how to design one?

  2. How do I know a DSL will make sense here?

  3. Most people don't write day DSLs or languages as part of their standard coding (or at least I don't) so even if I recognize a situation or a new language, or DSL would make sense, it's almost always more complex than a beginner is able to make, or will take to my time to learn how to do properly, and so just gets skipped.

  4. Debugging/Errors. I've run into this a lot more as I create larger programs. Racket doesn't give me the line number, or only vaguely points to the area where there is a problem. I end up having to run racket -l errortrace -t my-file.rkt because Racket doesn't add tracing by default. People say it's b/c it slows down the code, but I think that I would prefer that if all the debugging knobs were turned on by default, and that code could then be compiled in a release version with flags like 01/2/3 like in C/C++

Also I feel like the natural progression is to go from DrRacket->Emacs as you become more comfortable with Racket. I much prefer Emacs but DrRacket has better debugging tools and flipping back and forth in the middle of programming is an annoying context switch. I sometimes wish DrRacket was super performant so I could just use it for all of my Racket development.

  1. Profiling. I have a prime_sieve implementation written in typed racket. I could do a whole write up on this experience, but I'll briefly talk about it here. Due to the nature of typed racket I was unaware that I needed to add types to the profiler on import to get it to not fail when I tried to profile functions. Also everything is in classes so how do I profile a class method? The whole documentation around here is confusing and there aren't many examples so I'm still trying to figure out this part

  2. Optimization coach. Never has anything to say about my typed code. Could be using it wrong

  3. Typed Racket. Not the silver bullet I thought it would be. Can make my program slower. Pain in the butt to interact with non-typed code. Some libraries don't have typed versions. For example I was using bit-vector in my non-typed prime_sieve implementation but transitioned to a typed vector b/c it didn't work in typed racket and I was too dumb to figure out why.

I could go on, but I've overcome a lot of the issues and stuck with it. Some people might be asking why go through all the suffering if you can just have a better experience in Python. Even with all my gripes I like Racket. I like that it's compiled, I like that it's faster than Python, I like that it gives me options to statically type my programs, I like that it runs on a VM like Java or .net, I like that it runs on all the OSes I use with minimal set up, I like Schemes, I like the pushes it's been making to be more accessible, whether that's by making more of its core written in Scheme, changing its license, creating a successor language that doesn't use parenthesis, etc. Also it has taught me a lot. It was faaaar easier to understand recursion in Racket than it was in Python, plus I use Python in my day job, so I'd rather be working in another language at home. That's all I will say about this for now, if you got this far thanks for reading, and I hope you are enjoying Racket as much as I am :slight_smile:

8 Likes