Top 1,000 Features Creators Events Podcasts Extensions Blog Explorer CSV Download

Racket

< >

Racket is an open source programming language created in 1994 by Matthias Felleisen and Matthew Flatt and Robert Bruce Findler and Shriram Krishnamurthi.

#48on PLDB 30Years Old 18kRepos
Download source code:
git clone https://github.com/racket/racket

Try now: Riju ยท TIO

Racket is a general purpose, multi-paradigm programming language in the Lisp-Scheme family. One of its design goals is to serve as a platform for language creation, design, and implementation. The language is used in a variety of contexts such as scripting, general-purpose programming, computer science education, and research. Read more on Wikipedia...


Example from Riju:
#lang racket/base (display "Hello, world!\n")
Example from hello-world:
#lang racket "Hello World"
;; Hello world in Racket #lang racket/base "Hello, World!"
Example from Linguist:
; Clean, simple and efficient code -- that's the power of Racket! ; http://racket-lang.org/ (define (bottles n more) (printf "~a bottle~a of beer~a" (case n [(0) "no more"] [(1) "1"] [else n]) (if (= n 1) "" "s") more)) (for ([n (in-range 99 0 -1)]) (bottles n " on the wall, ") (bottles n ".\n") (printf "Take one down and pass it around, ") (bottles (sub1 n) " on the wall.\n\n")) (displayln "No more bottles of beer on the wall, no more bottles of beer.") (displayln "Go to the store and buy some more, 99 bottles of beer on the wall.")
Example from Wikipedia:
#lang typed/racket (: fact (Integer -> Integer)) (define (fact n) (cond [(zero? n) 1] [else (* n (fact (- n 1)))]))

Language features

Feature Supported Token Example
Print() Debugging โœ“ display
Homoiconicity โœ“
Line Comments โœ“ ;
; A comment
Module Pattern โœ“
(module nest racket
   (provide (for-syntax meta-eggs)
            (for-meta 1 meta-chicks)
            num-eggs)
   (define-for-syntax meta-eggs 2)
   (define-for-syntax meta-chicks 3)
   (define num-eggs 2))
Prefix Notation โœ“
(+ 1 2 3)
Mixins โœ“
(mixin (interface-expr ...) (interface-expr ...)
 class-clause ...)
Macros โœ“
; https://docs.racket-lang.org/guide/macros.html
(define-syntax-rule (swap x y)
(let ([tmp x])
  (set! x y)
  (set! y tmp)))
File Imports โœ“
(require (prefix-in tcp: racket/tcp))
Comments โœ“
Symbol Tables โœ“
;; Some programming languages allow the symbol table to be manipulated at run-time, so that symbols can be added at any time.
Lispy โœ“
Strings โœ“ "
"hello world"
Case Insensitive Identifiers X
Semantic Indentation X

View source

- Build the next great programming language ยท About ยท Resources ยท Acknowledgements ยท Part of the World Wide Scroll