Online Scheme - IDE, Editor, Compiler, Interpreter

Run Scheme code online: define functions, use recursion, lists, lambdas and tail calls in a Scheme interpreter that runs in your browser.

R7RS-style Scheme (BiwaScheme 0.8) · Runs in your browser, so your code never reaches our servers.
main.scmScheme
Output

            
        
Ctrl/⌘ + Enter to run

Features of the online Scheme compiler (IDE, editor & interpreter)

Write, run and test Scheme code online for free. This page works as an online Scheme IDE, code editor, compiler and interpreter in one: type your code, press Run and see the output straight away. Everything runs in your browser, with nothing to install and no account to create.

  • Run code instantly: R7RS-style Scheme (BiwaScheme 0.8), with output in under a second after the first load.
  • Code editor: syntax highlighting, line numbers, bracket matching and auto-closing brackets.
  • Clear errors: error messages and warnings appear in the output panel, as they would on your own computer.
  • Full screen: Ctrl/⌘ + Shift + F, adjustable font size, side-by-side or stacked layout and resizable panes.
  • Autosave: your code is kept in your browser; download it as main.scm or copy it in one click.
  • Safe to experiment: a time limit and a Stop button end infinite loops.
  • Private: the Scheme runtime runs on your device, so your code is never uploaded.
  • Dark mode and keyboard shortcuts: Ctrl/⌘ + Enter runs the code.
  • Free: no sign-up, no usage limits.

Learn other programming languages

How to use the online Scheme interpreter

  1. Write or paste Scheme code into the editor. Reset example restores the starter program, which prints a factorial, the first ten Fibonacci numbers and a sum of squares.
  2. Press Run or use Ctrl + Enter (⌘ + Enter on a Mac).
  3. Text written with display, write and newline appears in the Output panel. When the program finishes, the value of the last expression is printed as => value, unless that value is unspecified. Errors are reported with BiwaScheme's own message.
  4. Choose a time limit of 5, 15 or 60 seconds. An endless loop is stopped automatically, and Stop ends a run at once.

The interpreter is only about 0.3 MB, so the page is ready almost immediately. Copy and main.scm save your program, and Full screen (Ctrl/⌘ + Shift + F, Esc to leave) gives the editor the whole window.

Your code runs in a Web Worker inside your browser and is never sent to a server. The editor auto-saves your last program in your browser's local storage, separately for each compiler on this site.

About Scheme and BiwaScheme

Scheme is a small dialect of Lisp. Programs are parenthesised expressions, functions are ordinary values, and recursion is the normal way to loop. Its tiny core makes it a popular teaching language for closures, higher-order functions and interpreters.

This page runs BiwaScheme 0.8.3, a Scheme interpreter written in JavaScript. It follows the R6RS and R7RS standards in style and covers the most common Scheme features. It is not a complete implementation of either standard, though.

What's supported

  • Core forms: define, lambda, let, let*, letrec, if, cond, begin and set!.
  • Lists and higher-order functions: cons, car, cdr, list, map, apply and quoted data such as '(1 2 3).
  • Proper tail calls, so loops written as named let or tail-recursive functions run in constant stack space.

Limitations:

  • No input box. Put test data directly in the program.
  • Not a full standard implementation. Procedures specific to other Schemes, such as MIT Scheme, Racket or Guile, may be missing.
  • Only the code in the editor runs. There are no files to load and no package manager.

Worked example: recursion vs named let

;; Plain recursion: each call waits for the next one to return.
(define (sum-list lst)
  (if (null? lst)
      0
      (+ (car lst) (sum-list (cdr lst)))))

;; Named let: a tail-recursive loop with an accumulator.
(define (sum-to n)
  (let loop ((i 1) (acc 0))
    (if (> i n)
        acc
        (loop (+ i 1) (+ acc i)))))

(display (sum-list '(1 2 3 4))) (newline)   ; 10
(sum-to 100000)                             ; => 5000050000

The last expression is not displayed, so its value appears as => 5000050000. sum-list builds up pending additions, while sum-to calls loop in tail position and behaves like a while loop.

Common pitfalls

  • Forgetting to quote a list. (1 2 3) tries to call 1 as a function and fails. Write '(1 2 3) or (list 1 2 3). The two differ: '(a b) is a list of the symbols a and b, while (list a b) evaluates the variables.
  • define vs let. A top-level define creates a global name. let creates local names that exist only inside its body. Inside a plain let, one binding cannot refer to another, so use let* when a later value depends on an earlier one.
  • display vs write. display prints strings without quotes. write keeps them, which helps when you debug data.
  • Equality. Use = for numbers, eq? for symbols, and equal? to compare lists or strings by content.

Frequently asked questions

Is this a Scheme compiler or an interpreter?

An interpreter. BiwaScheme runs your program directly in the browser with no separate compile step.

Which Scheme standard is supported?

BiwaScheme follows R6RS and R7RS in style and covers the most common features. Standard textbook code that uses define, lambda, let, cond, lists and recursion runs as expected. Code that depends on one implementation's libraries may need changes.

Can I use it for SICP or course exercises?

Yes, for exercises built on core Scheme. If an exercise uses a procedure that is not defined, write a small version of it yourself at the top of the program.

Why does my program print nothing?

Only display, write and newline produce output, plus the => line for the value of the last expression. A program that ends with a define shows no value, because that result is unspecified.

What other languages can I run online?

Try the online Clojure compiler for another Lisp, the online Prolog compiler for logic programming, or browse all online compilers.

Copied to clipboard