:InitializePascal --
#
#	Precompute the first few rows of Pascal's triangle and store
#	them in the variable ::math::pascal
#
# Parameters:
#	None.
#
# Results:
#	None.
#
# Side effects:
#	::math::pascal is initialized to a flat list containing 
#	the first 34 rows of Pascal's triangle.	 C(n,k) is to be found
#	at [lindex $pascal $i] where i = n * ( n + 1 ) + k.  No attempt
#	is made to exploit symmetry.
#
#----------------------------------------------------------------------

proc ::math::InitializePascal {} {

    variable pascal

    set pascal [list 1]
    for { set n 1 } { $n < 34 } { incr n } {
	lappend pascal 1
	set l2 [list 1]
	for { set k 1 } { $k < $n } { incr k } {
	    set km1 [expr { $k - 1 }]
	    set c [expr { [lindex $l $km1] + [lindex $l $k] }]
	    lappend pascal $c
	    lappend l2 $c
	}
	lappend pascal 1
	lappend l2 1
	set l $l2
    }

}
