::tcl::mathfuncTop, Main, Index
CommandsTop, Main, Index
divll [::tcl::mathfunc]Top, Main, Index
Divides each element of the list1 to each element of list2
Parameters
list1 | First list of values. |
list2 | Second list of values. |
Return value
list
proc ::tcl::mathfunc::divll {list1 list2} { # Divides each element of the list1 to each element of list2 # list1 - first list of values # list2 - second list of values # Returns: list set result [list] if {[llength $list1]!=[llength $list2]} { return -code error "Lengths of the input lists '[llength $list1]' and '[llength $list2]' are not equal" } foreach value1 $list1 value2 $list2 { lappend result [= {double($value1)/double($value2)}] } return $result }
divlsc [::tcl::mathfunc]Top, Main, Index
Divides each element of the list to scalar value
Parameters
list | List of values. |
scalar | Scalar divider. |
Return value
list
proc ::tcl::mathfunc::divlsc {list scalar} { # Divides each element of the list to scalar value # list - list of values # scalar - scalar divider # Returns: list set result [list] foreach value $list { lappend result [= {double($value)/double($scalar)}] } return $result }
exactone [::tcl::mathfunc]Top, Main, Index
Calculates boolean function that returns true
if only exactly one element is true
Parameters
args | Boolean values. |
Return value
boolean
proc ::tcl::mathfunc::exactone {args} { # Calculates boolean function that returns `true` if only exactly one element is `true` # args - boolean values # Returns: boolean set first false foreach arg $args { if {$first && $arg} { return false } if {$arg} { set first true } } if {$first} { return true } else { return false } }
li [::tcl::mathfunc]Top, Main, Index
Wraps lindex
command into expr function
Parameters
list | Not documented. |
index | Not documented. |
proc ::tcl::mathfunc::li {list index args} { # Wraps `lindex` command into expr function ::lindex $list $index {*}$args }
lindex [::tcl::mathfunc]Top, Main, Index
Wraps lindex
command into expr function
Parameters
list | Not documented. |
index | Not documented. |
proc ::tcl::mathfunc::lindex {list index args} { # Wraps `lindex` command into expr function ::lindex $list $index {*}$args }
llength [::tcl::mathfunc]Top, Main, Index
Wraps llength
command into expr function
Parameters
list | Not documented. |
proc ::tcl::mathfunc::llength {list} { # Wraps `llength` command into expr function ::llength $list }
logb [::tcl::mathfunc]Top, Main, Index
Implements logarithm function with arbitary base
Parameters
value | Value to calculate the logarithm from. |
base | Logarithm base. |
Return value
value of logarithm
proc ::tcl::mathfunc::logb {value base} { # Implements logarithm function with arbitary base # value - value to calculate the logarithm from # base - logarithm base # Returns: value of logarithm return [= {log($value)/double(log($base))}] }
lrange [::tcl::mathfunc]Top, Main, Index
Wraps lrange
command into expr function
Parameters
list | Not documented. |
first | Not documented. |
last | Not documented. |
proc ::tcl::mathfunc::lrange {list first last} { # Wraps `lrange` command into expr function ::lrange $list $first $last }
maxl [::tcl::mathfunc]Top, Main, Index
Wraps ::tcl::mathfunc::max command to accept single list instead of expanded one
Parameters
list | Not documented. |
proc ::tcl::mathfunc::maxl {list} { # Wraps ::tcl::mathfunc::max command to accept single list instead of expanded one return [::tcl::mathfunc::max {*}$list] }
minl [::tcl::mathfunc]Top, Main, Index
Wraps ::tcl::mathfunc::min command to accept single list instead of expanded one
Parameters
list | Not documented. |
proc ::tcl::mathfunc::minl {list} { # Wraps ::tcl::mathfunc::min command to accept single list instead of expanded one return [::tcl::mathfunc::min {*}$list] }
mulll [::tcl::mathfunc]Top, Main, Index
Multiplies each element of the list1 to each element of list2
Parameters
list1 | First list of values. |
list2 | Second list of values. |
Return value
list
proc ::tcl::mathfunc::mulll {list1 list2} { # Multiplies each element of the list1 to each element of list2 # list1 - first list of values # list2 - second list of values # Returns: list set result [list] if {[llength $list1]!=[llength $list2]} { return -code error "Lengths of the input lists '[llength $list1]' and '[llength $list2]' are not equal" } foreach value1 $list1 value2 $list2 { lappend result [= {double($value1*$value2)}] } return $result }
mullsc [::tcl::mathfunc]Top, Main, Index
Multiplies each element of the list to scalar value
Parameters
list | List of values. |
scalar | Scalar multiplier. |
Return value
list
proc ::tcl::mathfunc::mullsc {list scalar} { # Multiplies each element of the list to scalar value # list - list of values # scalar - scalar multiplier # Returns: list set result [list] foreach value $list { lappend result [= {double($scalar*$value)}] } return $result }
powll [::tcl::mathfunc]Top, Main, Index
Exponentiates each element of the list1 in each element of list2
Parameters
list1 | First list of values. |
list2 | Second list of values. |
Return value
list
proc ::tcl::mathfunc::powll {list1 list2} { # Exponentiates each element of the list1 in each element of list2 # list1 - first list of values # list2 - second list of values # Returns: list set result [list] if {[llength $list1]!=[llength $list2]} { return -code error "Lengths of the input lists '[llength $list1]' and '[llength $list2]' are not equal" } foreach value1 $list1 value2 $list2 { lappend result [= {pow($value1,$value2)}] } return $result }
powlsc [::tcl::mathfunc]Top, Main, Index
Exponentiates each element of the list in scalar value
Parameters
list | List of values. |
scalar | Scalar power value. |
Return value
list
proc ::tcl::mathfunc::powlsc {list scalar} { # Exponentiates each element of the list in scalar value # list - list of values # scalar - scalar power value # Returns: list set result [list] foreach value $list { lappend result [= {pow($value,$scalar)}] } return $result }
subll [::tcl::mathfunc]Top, Main, Index
Subtracts each element of the list2 from each element of list1
Parameters
list1 | First list of values. |
list2 | Second list of values. |
Return value
list
proc ::tcl::mathfunc::subll {list1 list2} { # Subtracts each element of the list2 from each element of list1 # list1 - first list of values # list2 - second list of values # Returns: list set result [list] if {[llength $list1]!=[llength $list2]} { return -code error "Lengths of the input lists '[llength $list1]' and '[llength $list2]' are not equal" } foreach value1 $list1 value2 $list2 { lappend result [= {double($value1-$value2)}] } return $result }
sublsc [::tcl::mathfunc]Top, Main, Index
Subtracts scalar value from each element of the list
Parameters
list | List of values. |
scalar | Scalar value to subtract. |
Return value
list
proc ::tcl::mathfunc::sublsc {list scalar} { # Subtracts scalar value from each element of the list # list - list of values # scalar - scalar value to subtract # Returns: list set result [list] foreach value $list { lappend result [= {double($value-$scalar)}] } return $result }
sumll [::tcl::mathfunc]Top, Main, Index
Sums each element of the list1 with each element of list2
Parameters
list1 | First list of values. |
list2 | Second list of values. |
Return value
list
proc ::tcl::mathfunc::sumll {list1 list2} { # Sums each element of the list1 with each element of list2 # list1 - first list of values # list2 - second list of values # Returns: list set result [list] if {[llength $list1]!=[llength $list2]} { return -code error "Lengths of the input lists '[llength $list1]' and '[llength $list2]' are not equal" } foreach value1 $list1 value2 $list2 { lappend result [= {double($value1+$value2)}] } return $result }
sumlsc [::tcl::mathfunc]Top, Main, Index
Adds scalar value to each element of the list
Parameters
list | List of values. |
scalar | Scalar value to add. |
Return value
list
proc ::tcl::mathfunc::sumlsc {list scalar} { # Adds scalar value to each element of the list # list - list of values # scalar - scalar value to add # Returns: list set result [list] foreach value $list { lappend result [= {double($scalar+$value)}] } return $result }