Racket Start (Install, Setup)
First, download and install. Just follow instructions. It's easy.
download at http://download.racket-lang.org/
just run the downloaded thing.
it'll ask you about 3 questions.
on linux, it'll ask you if you want to install in your own directory in one place. Say yes to that.
Here's the terminal session log:
2015-10-05 ~/Downloads/xxx43912 $ sh racket-6.2.1-x86_64-linux-ubuntu-precise.sh This program will extract and install Racket v6.2.1. Note: the required diskspace for this installation is 474M. Do you want a Unix-style distribution? In this distribution mode files go into different directories according to Unix conventions. A "racket-uninstall" script will be generated to be used when you want to remove the installation. If you say 'no', the whole Racket directory is kept in a single installation directory (movable and erasable), possibly with external links into it -- this is often more convenient, especially if you want to install multiple versions or keep it in your home directory. Enter yes/no (default: no) > Where do you want to install the "racket" directory tree? 1 - /usr/racket [default] 2 - /usr/local/racket 3 - ~/racket (/home/xah/racket) 4 - ./racket (here) Or enter a different "racket" directory to install in. > 3 Checking the integrity of the binary archive... ok. Unpacking into "/home/xah/racket" (Ctrl+C to abort)... Done. If you want to install new system links within the "bin", "man" and "share/applications" subdirectories of a common directory prefix (for example, "/usr/local") then enter the prefix of an existing directory that you want to use. This might overwrite existing symlinks, but not files. (default: skip links) > Installation complete. ~/Downloads/xxx43912 $
after install, here are 2 important directories.
~/racket/→ the Racket directory. Main racket stuff. Binaries, documentation, etc.
~/.racket/→ User libs, user stuff
the Racket directory path may be at whatever path you specified during install. You can move it to a new path. Do that now.
On linux, you want to add racket binary path to your PATH environment variable.
# add racket path PATH=$HOME/racket/bin:$PATH
put it in your bash init file. [see Difference Between .bashrc, .profile, .bash_profile, …?]
Important Terminal Commands
racketis the main thing. It's compiler and REPL.
racois install/build tool. (such as installing modules.)
you can run
To start REPL, type
racket in terminal.
in REPL, try
(+ 3 4)
to exit racket REPL, type Ctrl+d
drracket is simple IDE, mostly for beginner programer.
You can use emacs to code racket. See: Racket: Using Emacs racket-mode .
run racket source file
to run a racket file, do
racket file ends in
.rkt (and others)
sample racket program
#lang racket (+ 3 2)
it should start with
This is a sugar syntax that expands
which creates a module (named based on current file name) and other things.
racket can create binary executable.
raco exe src-filename
Racket documentation is very well organized. You can find it all, at
there are 2 main things.
- The Racket Guide (a small book-length tutorial, for those familiar with lisp.)
- The Racket Reference (the full documentation. More like a lang spec, but easy-to-understand.)
There are also several tutorials. It's all linked above at the doc page.