f::transpose (public)
f::transpose lists
Defined in packages/acs-tcl/tcl/ad-functional-procs.tcl
Transposes a matrix (a list of lists)
- Parameters:
- lists (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- functional_api
Source code: set num_lists [llength $lists] if {!$num_lists} { return "" } for {set i 0} {$i<$num_lists} {incr i} { set l($i) [lindex $lists $i] } set result {} while {1} { set element {} for {set i 0} {$i<$num_lists} {incr i} { if {[null_p $l($i)]} { return $result } lappend element [head $l($i)] set l($i) [tail $l($i)] } lappend result $element } # Note: This function takes about n*n seconds # to transpose a (100*n) x (100*n) matrix. # Pretty fast, don't you think? :)XQL Not present: Generic, PostgreSQL, Oracle