[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 13 Jul 2005 20:44:31 -0000


albertel		Wed Jul 13 16:44:31 2005 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  - adding some idea to support web CT 'sum' function
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.100 loncom/homework/default_homework.lcpm:1.101
--- loncom/homework/default_homework.lcpm:1.100	Fri Jun 17 16:24:56 2005
+++ loncom/homework/default_homework.lcpm	Wed Jul 13 16:44:29 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.100 2005/06/17 20:24:56 albertel Exp $
+# $Id: default_homework.lcpm,v 1.101 2005/07/13 20:44:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -890,6 +890,30 @@
     return $_[$num];
 }
 
+#&sum1(1,$x,sub { &sum1($_[0],2*$_[0], sub { fact($_[0])**2 })});
+#sub sum1 {
+#    my ($start,$end,$sub)=@_;
+#    my $sum=0;
+#    for (my $i=$start;$i<=$end;$i++) {
+#        $sum+=&$sub($i);
+#    }
+#    return $sum
+#}
+
+#&sum2('a',1,$x,'&sum2(\'b\',$a,2*$a, \'&factorial($b)**2\')');
+#sub sum2 {
+#    my ($varname,$start,$end,$line)=@_;
+#    my $sum=0;
+#    for (my $i=$start;$i<=$end;$i++) {
+#	my $func=sub {
+#	    eval("\$".$varname."=$i");
+#	    eval($line);
+#	};
+#        $sum+=&$func($i);
+#    }
+#    return $sum
+#}
+
 # expiremental idea
 sub proper_path {
     my ($path)=@_;