0 works

Quicksort in Scheme


dashboard+ Project

Posted by @baristageek #lisp

(define (quicksort lst op)
 (if (null? lst)
 lst
 (let* ((one (car lst))
 (left (filter (lambda (x)
 (op x one))
 (cdr lst)))
 (right (filter (lambda (x)
 (not (op x one)))
 (cdr lst))))
 (append (quicksort left op) (list one) (quicksort right op)))))
content_copyCopy to Clipboard

>> Browse more code snippets

more_vert