qsort

one of the documented procedures in this installation of the ACS
Usage:
qsort   xs   { value "id" }
What it does:
sorts a sequence with the quicksort algorithm
Defined in: /web/philip/tcl/ad-functional.tcl

Source code:


    if { [llength $xs]<2 } { return $xs }
    set pivot [head $xs]
    set big_elmts {}
    set small_elmts {}
    foreach x [tail $xs] {
	if { [eval_unary $value $x] > [eval_unary $value $pivot] } {
	    lappend big_elmts $x
	} else {
	    lappend small_elmts $x
	}
    }
    concat [qsort $small_elmts $value] [list $pivot] [qsort $big_elmts $value]


philg@mit.edu