f::qsort (public)
f::qsort xs [ value ]
Defined in packages/acs-tcl/tcl/ad-functional-procs.tcl
Sorts a sequence with the quicksort algorithm. Examples: f::qsort {5 2 9 4} = 2 4 5 9 f::qsort {Oracle ArsDigita SAP Vignette} [lambda {s} {string length $s}] = {SAP Oracle Vignette ArsDigita}
- Parameters:
- xs (required)
- value (optional, defaults to
"id"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- functional_api
Source code: if { [llength $xs]<2 } { return $xs } set pivot [head $xs] set big_elmts {} set small_elmts {} foreach x [tail $xs] { if { [$value $x] > [$value $pivot] } { lappend big_elmts $x } else { lappend small_elmts $x } } concat [qsort $small_elmts $value] [list $pivot] [qsort $big_elmts $value]XQL Not present: Generic, PostgreSQL, Oracle