Help for this page

Select Code to Download


  1. or download this
    (define (sum-integers a b)
       (if (> a b)
           0
           (+ a (sum-integers (+ a 1) b))))
    
  2. or download this
    (define (sum-cubes a b)
       (if (> a b)
           0
           (+ (cube a) (sum-cubes (+ a 1) b))))
    
  3. or download this
    (define (sum term a next b)
       (if (> a b)
    ...
           (+ (term a)
              (sum term (next a) next b))))
    
  4. or download this
    (define (inc n) (+ n 1))
     (define (sum-cubes a b)
       (sum cube a inc b))
    
  5. or download this
    sub sum_integers {
        my ($a, $b) = @_;
    ...
        if ($a > $b) { return(0); }
        else { return( &cube($a) + &sum_cubes(($a + 1), $b) ); }
    }
    
  6. or download this
    sub sum {
        my ($term, $a, $next, $b) = @_;
    ...
        my ($a, $b) = @_;
        return( &sum(&cube, $a, &inc, $b) );
    }