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.
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.
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.
#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)
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.
(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.
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.
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.
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.
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.
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.
main.rktschemeread-line#lang racket
(displayln "Hello from Racket!")
(displayln "Welcome to XCODX Online Compiler!")