Greg Hendershott

greghendershott.com · Personal blog · on HN since 2012

Greg Hendershott is a Racket programmer who writes about macros, Racket tooling, and his own projects built with Racket.

What HN saysCommenters repeatedly recommend his 'Fear of Macros' tutorial as the best guide to Racket macros, and mention his Racket-mode for Emacs.
43HN people shared it
26linked it in comments
24stories submitted
833story points
3 months agolast shared
2012people per year2026

Most-shared posts

  1. 1
    Fear of Macros
    14 people · 220 points · first shared 2012 · 56 comments on HN
  2. 2
  3. 3
    Fear of Macros
    5 people · 3 points · first shared 2014 · discussion on HN
  4. 4
    #lang rackjure – Clojure-inspired ideas in Racket
    4 people · 5 points · first shared 2015 · discussion on HN
  5. 5
    Future of Racket
    2 people · 72 points · first shared 2019 · 38 comments on HN
  6. 6
    Exploding Frog (2019)
    2 people · 10 points · first shared 2020 · 2 comments on HN
  7. 7
  8. 8
    The ~ Threading Macro
    2 people · 1 points · first shared 2013 · discussion on HN
  9. 9
    Racket mode
    2 people · first shared 2018
  10. 10
    GitHub dropped Pygments
    1 people · 184 points · first shared 2014 · 129 comments on HN
  11. 11
    Fear of Macros
    1 people · 101 points · first shared 2014 · 30 comments on HN
  12. 12
    Understanding and Using C Pointers
    1 people · 2 points · first shared 2013 · discussion on HN
  13. 13
    A Git Guide for Infrequent Contributors
    1 people · 2 points · first shared 2014 · discussion on HN
  14. 14
    Racket Workflow
    1 people · 1 points · first shared 2015 · discussion on HN
  15. 15
    Fear of Macros
    1 people · 1 points · first shared 2016 · discussion on HN

What HN people wrote when they linked it

cmpitg · 2014-08-01
You might want to combine Geiser with Quack[1] for best result with Scheme. Also, I think it's worth a shot to have a look at the fairly new Racket-mode[2] written by Greg[3]. Geiser + Quack are rather old and for Scheme in general, Racket-mode focuses on and is tightly integrated with Racket. [1] http://www.neilvandyke.org/quack/ [2] https://github.com/greghendershott/racket-mode [3] http://www.greghendershott.com/
alethic · 2026-08-17
Racket and Rhombus are nice for writing embedded DSLs, yeah. More generally, they're nice for writing macros. Scheme in general is nice for writing macros with its `syntax-case` and first-class notions of syntax objects, but Racket is /really/ nice with its `syntax-parse` and explicit notions of phase levels... If you are interested in learning, Greg Hendershott's "Fear of Macros" is often recommended as a good introduction. https://www.greghendershott.com/fear-of-macros/
mumblemumble · 2020-12-16
Good point. For that part, my favorite guide is https://www.greghendershott.com/fear-of-macros/
doomrobo · 2016-07-18
A great tutorial on macros in Racket is Fear of Macros by Greg Hendershott. http://www.greghendershott.com/fear-of-macros/all.html
jpolitz · 2015-03-18
Two 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/. 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. For example, used to build http://www.greghendershott.com/rackjure/. Greg Hendershott does some great writeups, there's more to find on his site.
takikawa · 2013-08-05
A good guide to start out with Racket's macro system is Greg Hendershott's excellent Fear of Macros tutorial: http://www.greghendershott.com/fear-of-macros/
ashton314 · 2024-09-29
The way you phrased that suggests you're only familiar with CL-style macros, where arguments to macros are nested lists of symbols a function or variable is known by it's name (a symbol) and nothing more. Racket's model is much more sophisticated and powerful. The input to a macro in Racket is a syntax object [1], which combines the CL-like quoted expression with additional source and lexical binding information. This means that in Racket, unlike CL, a variable is not just it's name—it's also all this other information. Racket uses scope sets to track binding information in a sane and hygienic manner across different macros and functions. So, if you want to introduce an identifier that the macro caller can interact with (note: I said an identifier—you can introduce any symbols you want but they'll be different identifiers because their scope sets will be different) you need to explicitly state that you would like to create an identifier with a particular scope set. [4] But that's the old, dumpy, clunky way of doing things. Thanks to recent research, we have much better ways of introducing identifiers in a sane, hygienic way. Gregg Hendershott's excellent "Fear of Macros" walks through making the `aif` macro using syntax parameters [3] which let you cleanly introduce new bindings. (See the paper "Keeping it Clean with Syntax Parameters" he's linked to in his post.) So, in short, no, we're not back to regular CL macros because Racket prevents us from accidental variable…
reikonomusha · 2022-09-05
I'm a heavy user of Common Lisp, and I only dabble in Racket from time to time. While Common Lisp is my tool of choice for a lot of reasons stated in the post, since the post largely skews favorably toward Common Lisp, I'll offer two things that Racket shines at: 1. Documentation Racket has a beautiful documentation system called Scribble [0]. Almost all documentation written for Common Lisp is ugly, inconsistent, and doesn't follow any sort of standard. Common Lisp has a gazillion "documentation generators" which do little more than slurp up all the documentation strings and barf them back out as e.g. HTML. Common Lisp users tend to just rely on READMEs + jump-to-definition to learn how a project works. A few Lisp programmers (e.g., Shinmera, Edi Weitz) have made their own documentation systems that look better than average, but are still at least an order of magnitude less capable than Racket's offering. Racket's documentation system is aesthetically pleasing, very well organized, and makes the programmer want to write long-form documentation. Moreover, Racket (the language) sets a superlative example of what its users can strive for in terms of quality of clear, no-nonsense writing. 2. Languages and DSLs One of Lisp's (any dialect) defining features is the ability to build domain-specific languages, syntactic extensions, and the like by way of a special kind of function that can run prior to the code's execution. These special functions are called "macros", and…
notjack · 2017-01-25
Hi, Racket community member here. Thanks for the in-depth comment about your experience, and thanks for writing about your work with the webserver library! A couple follow up questions if you've got the time: 1. Could you elaborate on the stacktrace issues you encountered? 2. The Gregor package [0] is currently a bit of a community standard for date and time functionality. There's a general desire to merge this into the Racket stdlib. Would this package suit your needs? 3. For string templates, a lot of folks use Scribble "at expressions" via the `at-exp` meta-language combined with format specifiers from `racket/format` to write code that looks very similar to python string interpolation and other language-integrated string formatting systems. You can see an example of that on Greg Hendershott's blog [1]. Would this work for your use cases or were you looking for something a bit more involved? [0] http://docs.racket-lang.org/gregor/ [1] http://www.greghendershott.com/2015/08/at-expressions.html
veqq · 2024-08-20
> It is really used much in companies? Cisco seems to use Chez for something mysterious, a video game company scripted in Scheme, stopped and restarted again. I know a guy who does option trading in Racket, I have some large valuation models in Racket (most of the system is in and Common Lisp). I know a few guys who do vague data analysis and scripting in scheme (especially Guile or Gerbil for some reason) where their clients only care about the result. https://www.itasoftware.com/ is in scheme. There are some dead webshops(?) like https://www.greghendershott.com/2018/05/extramaze-llc-using-racket-pos… or https://defn.io/2019/08/20/racket-ecommerce/ That's about it.
cess11 · 2024-04-21
Racket is a very practical language. If you have the impression that it's some academic quirk you should take a look at what Bogdan Popa is doing with it: https://defn.io/ When I personally want a binary with a native GUI I turn to Racket. It's also pretty nice for parsing stuff, like JSON, XML, some text-file formats. The companion book How to design programs, https://htdp.org/2023-8-14/Book/index.html , is nice too, while it doesn't exactly teach Racket (it uses a couple of teaching languages implemented in Racket) it has some valuable ideas that are good to be reminded of every now and then. The macro system might seem weird if one comes from e.g. CL, but once I got used to it I found it relatively easy to stay sane while doing metaprogramming. A couple of more resources that are useful: https://www.greghendershott.com/fear-of-macros/ https://beautifulracket.com/
emmanueloga_ · 2020-05-10
So part of the problem is that racket mode has a bus factor of 1. I saw that the maintainer posted this [1] a while ago, which is a bit concerning. My point is that would be ideal if the core Racket team also participated in polishing the IDE integrations, other than Dr Racket. 1: https://www.greghendershott.com/2019/07/future-of-racket.html
neilv · 2019-08-04
Another one is Joe Marshall's "syntax-rules Primer for the Merely Eccentric": http://sites.google.com/site/evalapply/eccentric.txt Today, instead of `syntax-rules`, you'll probably use `syntax-case`, which is a lot easier to use for harder purposes, and also easier error-checking, just not as interesting as `syntax-rules`. Or, if you're using Racket, `syntax-parse`. Greg Hendershott's "Fear of Macros" should be an easy introduction to some of the newer ways, though it has some Racket-specific bits in it: https://www.greghendershott.com/fear-of-macros/
darkpuma · 2019-05-16
tgbugs · 2019-05-16
For Racket specific macro tooling syntax-parse [0] in combination with syntax classes is usually the suggested starting point. Hygenic with pattern matching and a bunch of other features for parsing s-expression grammars. As mentioned down-thread Greg Hendershott's Fear of Macros [1] is a good starting point for a number of folks. The curriculum for Racket School 2018 [2] also has exercises that help introduce the syntax-parse tooling. 0. https://docs.racket-lang.org/syntax/Parsing_Syntax.html 1. https://www.greghendershott.com/fear-of-macros/ 2. https://summer-school.racket-lang.org/2018/plan/
lispm · 2019-03-06
http://www.greghendershott.com/fear-of-macros/fear-of-macros.jpg Which would easily make decades old and still maintained Lisp implementations unmaintainable, since they contain zillions of macros themselves.
hsitz · 2019-01-31
At least for people who want to use Emacs and Racket, it seems like this Emacs project provides the client/server kind of setup you're talking about. Or no?: https://www.greghendershott.com/2018/10/racket-mode.html
jboynyc · 2019-01-31
Here's a little write-up from somebody who uses Racket in production in a commercial web product: https://www.greghendershott.com/2018/05/extramaze-llc-using-racket-pos…
tonyg · 2018-10-22
Lots of people who hack on and hack with Racket (including me) use Greg Hendershott's racket-mode [0] in Emacs. It's good. Greg also wrote a blog post about it recently [1] which might be of interest. [0] https://github.com/greghendershott/racket-mode [1] https://www.greghendershott.com/2018/10/racket-mode.html
nerd_stuff · 2015-07-06
He's apparently talking about Clojure's thread macro specifically. If you're not familiar it can be a way to organize code in a straightforward, human-readable, easily debuggable syntax. Ex: (~> (sha1 in) (bytes->hex-string) (bytes-append #".") (displayln)) In pseudo-Python this would be: displayln(bytes-append(bytes->hex-string(sha1(in)), #".")) http://www.greghendershott.com/2013/05/the-threading-macro.html
Johnny_Brahms · 2015-03-27
Hmmm. The syntax stuff could easily be implemented using macros. I like using rackjure by Greg Hendershott: http://www.greghendershott.com/rackjure/ Adding the if statements wouldn't be too much fuzz.
sea6ear · 2015-03-26
I believe Rackjure [0] gives some of the particular conveniences of Clojure back to Racket. [0] http://www.greghendershott.com/rackjure/
Legion · 2014-04-17
EDIT: By browsing to the Github repo, I found the link to the One Big HTML page: http://www.greghendershott.com/fear-of-macros/all.html Original post: I wish there was a single-page version of this that I could Pocket. Or an epub that I could put on my reading devices. I don't tend to read multi-page things like this at my desk, not in this era of high-resolution lightweight portable screens.
iddiid · 2020-05-19
From (1) Fear of Macros ( this is from someone that mainly program in racket, not my personal opinion) But the moment I stepped past routine pattern-matching, I kind of fell off a cliff into a terminology soup. I marinaded myself in material, hoping it would eventually sink in after enough re-readings. I even found myself using trial and error, rather than having a clear mental model what was going on. Gah. (1) https://www.greghendershott.com/fear-of-macros/all.html My personal opinion: I think racket is more an ivory tower for researcher, many for northwest university. “PLT” refers to the group that is the core of the Racket development team. PLT consists of numerous people distributed across several different universities in the USA. As I am getting older I should prefer some middle ground between racket and go. Hygienic macros are difficult to understand in this context, that is I don't want to buy the power of hygienic macros, it is over sold. Anyway, I admire Mattew Flatt efforts in compilation tecniques and the author of Beautiful Racket.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close