Skip to content

Instantly share code, notes, and snippets.

@ruliana
Created February 11, 2016 00:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruliana/8016b636123c693934ed to your computer and use it in GitHub Desktop.
Save ruliana/8016b636123c693934ed to your computer and use it in GitHub Desktop.
Quicksort implemented in Racket
#lang racket
(define/match (quicksort elements)
[('()) '()]
[((list pivot rest ...))
(define (<pivot x) (< x pivot))
(define-values (small large) (partition <pivot rest))
(append (quicksort small)
(list pivot)
(quicksort large))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment