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 calls itself a language for making languages — a Scheme descendant re-engineered by the PLT group into a platform where building a new #lang is a library exercise. That research pedigree translated into a teaching empire: 'How to Design Programs' and its student languages introduced program design to a generation of CS students, and Racket still anchors intro and programming-languages courses at Northeastern, Waterloo, Utah, and beyond. The current 8.x series runs on the Chez Scheme backend for a substantially faster runtime. It's also simply a pleasant modern Scheme with batteries: pattern matching, contracts, structs, and big standard libraries. Run Racket on this page in an interactive terminal — read-line takes your typed input live, no DrRacket required.

Hello World in Racket

#lang racket

(display "What's your name? ")
(flush-output)
(define name (read-line))
(printf "Hello, ~a!\n" name)

(display "Enter integers separated by spaces: ")
(flush-output)
(define nums (map string->number (string-split (read-line))))

(printf "Sum: ~a\n" (apply + nums))
(printf "Squares: ~a\n" (map (lambda (n) (* n n)) nums))
(printf "Evens only: ~a\n" (filter even? nums))
(printf "Folded product: ~a\n" (foldl * 1 nums))

When to use Racket

If your course uses 'How to Design Programs' or covers interpreters and continuations, Racket is your daily driver — and this page lets you run full #lang racket programs from any device when DrRacket isn't installed, such as a library computer or tablet keyboard setup. It's equally good for practicing the functional core that exams test: map/filter/foldl, recursion on lists, higher-order functions, and tail calls. Developers curious about language-oriented programming can prototype S-expression manipulation here before diving into Racket's macro system locally.

Common questions

Can I use read-line and read interactively in this terminal?

Yes — both block until you type input, because the program runs against a live terminal rather than a canned stdin. Call (flush-output) after display-ing a prompt without a newline so it appears before the pause. Sequential prompts, then computation, then more prompts all behave as expected.

Do I need the #lang racket line?

Yes — a Racket source file begins with a #lang declaration that selects the language, and #lang racket is the standard full language. This is core to Racket's design: the same runtime hosts teaching languages, typed/racket, and user-defined languages. Omitting the line is the most common beginner error.

Are teaching languages (BSL/ISL) or raco packages supported?

Programs here run under #lang racket with the main distribution's bundled collections; there is no raco pkg install for third-party packages. HtDP student languages are designed for DrRacket's UI, so translate exercises to plain Racket — usually just swapping (check-expect ...) for direct calls or simple equal? tests.

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!")