LinuxCommandLibrary

racket

Run Racket programs

TLDR

Start a REPL (interactive shell)

$ racket
copy

Execute a Racket script
$ racket [path/to/script.rkt]
copy

Execute a Racket expression
$ racket --eval "[expression]"
copy

Run module as a script (terminates option list)
$ racket --lib [module_name] --main [arguments]
copy

Start a REPL (interactive shell) for the typed/racket hashlang
$ racket -I typed/racket
copy

SYNOPSIS

racket [ options ] [ file ]

PARAMETERS

-v, --version
    Display version information and exit.

-h, --help
    Display this help message and exit.

file
    The Racket source file to execute. If omitted, starts the REPL.

DESCRIPTION

The racket command typically isn't a standard Linux command itself, but rather it refers to using the Racket programming language environment in a Linux environment. Racket is a dialect of Lisp that supports a variety of programming paradigms, including functional, object-oriented, and procedural styles. It features a powerful macro system, supports creating domain-specific languages, and offers a rich set of libraries. When 'racket' is mentioned, it generally implies invoking the Racket interpreter to execute Racket programs or using the Racket interactive environment (REPL).

To "run" a Racket program from the command line, you'd use the `racket` executable followed by the Racket source file. The Racket interpreter will then execute the code in that file. You can also invoke the Racket REPL by simply typing `racket` in the terminal without any arguments. This allows you to interactively execute Racket code line by line. Racket programs usually have a `.rkt` extension.

REPL USAGE

Typing `racket` without arguments will launch the Racket REPL. This is an interactive environment where you can enter Racket expressions and see their results immediately.

FILE EXECUTION

To execute a Racket program stored in a file (e.g., `myprogram.rkt`), use the command `racket myprogram.rkt`.

SEE ALSO

scheme(1), guile(1)

Copied to clipboard