Hello World in Racket was written by:
This article was written by:
If you see anything you'd like to change or update, please consider contributing.
Let's go ahead and dig into our implementation of Hello World in Racket.
Up first, we have this peculiar line that looks kind of like a comment in Python
or an import in C. As it turns out, the
lang line specifies the language used by
the interpreter. In fact, I already mentioned that there's a module which
provides syntax for static typing in Racket.
In this case, the language we have chosen is
racket/base. This only provides us
the core Racket functionality. As an alternative, we could have easily specified
Finally, we have our print line. To be honest, we could have used the print functionality:
(print "Hello, World!)
However, I wanted to show that you can implement Hello World without the mess of parentheses. That's because Racket automatically prints constants. If we had a slightly more complicated expression:
+ 2 2
We would see the three constants returned to us in their stack order:
We would need parentheses to actually evaluate this expression.
At any rate, I think we're done here. If we want to try to run the solution, we can plug some of this code into an online Racket interpreter.
And, that's it. If successful, the "Hello, World!" string should print to the console.