XCODX |

Racket Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About Racket

Racket is a general-purpose language in the Lisp and Scheme tradition, developed by the PLT research group led by Matthias Felleisen, Matthew Flatt, Robert Bruce Findler, and Shriram Krishnamurthi. It began in 1995 as PLT Scheme and was renamed Racket in 2010. Its defining idea is language-oriented programming: every file starts with a #lang line, and the language is built to let you define new dialects and languages with macros. Racket is widely used in computer-science education and programming-language research, and it ships with a large batteries-included standard library. On XCODX, Racket runs in a cloud sandbox where you can explore #lang racket and its core forms straight from the browser.

Hello World in Racket

#lang racket

(display "What is your name? ")
(define name (read-line))
(displayln (string-append "Hello, " (if (eof-object? name) "stranger" name) "!"))

(define squares (for/list ([n (in-range 1 6)]) (* n n)))
(display "Squares: ")
(displayln squares)

When to use Racket

Racket is a strong choice for learning programming, teaching functional and recursive thinking, and experimenting with language design through its hygienic macro system. It suits interpreters, symbolic computation, and small tools where clear, composable functions matter more than raw speed. Reach for it when you want a friendly Lisp with an unusually complete standard library. It is a weaker fit for high-performance numerical or systems work, where a compiled, statically typed language will generally run faster.

Common questions

How do I read input in Racket?

(read-line) returns the next line from the current input port as a string, or an end-of-file object when the stream is closed, so guard it with (eof-object? x). On XCODX, type into the live terminal — execution pauses at read-line — or paste ahead of time into the Stdin Box, and use Ctrl+D to signal end of input. For a single number or symbol, (read) parses one datum instead of a whole line.

Can I install packages with raco pkg?

No. There is no raco pkg and no network access, so packages from the Racket catalog cannot be downloaded. You still have the collections bundled with the runtime — lists, strings, for-loops, math, and more — which is enough for most exercises and demos.

Do I need a #lang line at the top?

Yes. Start your program with #lang racket for the full language, or #lang racket/base for a smaller, faster-loading subset. Without a #lang declaration the file has no language to run under and will error.

What is the difference between read and read-line?

read-line consumes an entire line and hands it back as a string with the newline excluded. read parses exactly one Racket datum — a number, symbol, list, or string — using Racket syntax, which is handy when your input is already structured.

Can I build a GUI or use DrRacket here?

No. The sandbox is text-only: output goes to the terminal and there is no DrRacket IDE, no graphics window, and no file system to persist to. It is meant for console programs and quick experiments.

Which Racket version runs on XCODX?

The exact version appears in the badge beside the editor. It is free to use with no signup, and each run executes in a fresh environment with nothing carried over from previous runs.

How Racket runs on XCODX

Sandbox filename
main.rkt
Entry point
single main source file
Editor grammar
scheme
Reading stdin
read-line
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

#lang racket
(displayln "Hello from Racket!")
(displayln "Welcome to XCODX Online Compiler!")