[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 11 Apr 2002 13:35:23 -0000


matthew		Thu Apr 11 09:35:23 2002 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  A little more POD documentation for user-accessible spreadsheet functions.
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.83 loncom/interface/lonspreadsheet.pm:1.84
--- loncom/interface/lonspreadsheet.pm:1.83	Wed Apr 10 11:30:13 2002
+++ loncom/interface/lonspreadsheet.pm	Thu Apr 11 09:35:23 2002
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.83 2002/04/10 15:30:13 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.84 2002/04/11 13:35:23 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -508,6 +508,15 @@
     return $Values[-1];
 }
 
+#-------------------------------------------------------
+
+=item NUM(range)
+
+returns the number of items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub NUM {
     my $mask=mask(@_);
     my $num= $#{@{grep(/$mask/,keys(%v))}}+1;
@@ -527,6 +536,15 @@
 }
 
 
+#-------------------------------------------------------
+
+=item SUM(range)
+
+returns the sum of items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub SUM {
     my $mask=mask(@_);
     my $sum=0;
@@ -536,6 +554,15 @@
     return $sum;   
 }
 
+#-------------------------------------------------------
+
+=item MEAN(range)
+
+compute the average of the items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub MEAN {
     my $mask=mask(@_);
     my $sum=0; my $num=0;
@@ -550,6 +577,15 @@
     }   
 }
 
+#-------------------------------------------------------
+
+=item STDDEV(range)
+
+compute the standard deviation of the items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub STDDEV {
     my $mask=mask(@_);
     my $sum=0; my $num=0;
@@ -566,6 +602,15 @@
     return sqrt($sum/($num-1));    
 }
 
+#-------------------------------------------------------
+
+=item PROD(range)
+
+compute the product of the items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub PROD {
     my $mask=mask(@_);
     my $prod=1;
@@ -575,6 +620,15 @@
     return $prod;   
 }
 
+#-------------------------------------------------------
+
+=item MAX(range)
+
+compute the maximum of the items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub MAX {
     my $mask=mask(@_);
     my $max='-';
@@ -585,6 +639,15 @@
     return $max;   
 }
 
+#-------------------------------------------------------
+
+=item MIN(range)
+
+compute the minimum of the items in the range.
+
+=cut
+
+#-------------------------------------------------------
 sub MIN {
     my $mask=mask(@_);
     my $min='-';
@@ -595,12 +658,22 @@
     return $min;   
 }
 
+#-------------------------------------------------------
+
+=item SUMMAX(num,lower,upper)
+
+compute the sum of the largest 'num' items in the range from
+'lower' to 'upper'
+
+=cut
+
+#-------------------------------------------------------
 sub SUMMAX {
     my ($num,$lower,$upper)=@_;
     my $mask=mask($lower,$upper);
     my @inside=();
     foreach (grep /$mask/,keys(%v)) {
-	$inside[$#inside+1]=$v{$_};
+	push (@inside,$v{$_});
     }
     @inside=sort(@inside);
     my $sum=0; my $i;
@@ -610,6 +683,16 @@
     return $sum;   
 }
 
+#-------------------------------------------------------
+
+=item SUMMIN(num,lower,upper)
+
+compute the sum of the smallest 'num' items in the range from
+'lower' to 'upper'
+
+=cut
+
+#-------------------------------------------------------
 sub SUMMIN {
     my ($num,$lower,$upper)=@_;
     my $mask=mask($lower,$upper);