You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
226 B
Racket
12 lines
226 B
Racket
3 years ago
|
#! /usr/bin/racket
|
||
|
#lang racket/base
|
||
|
|
||
|
(define (sum term a next b)
|
||
|
(define (iter a result)
|
||
|
(if (> a b)
|
||
|
result
|
||
|
(iter (next a) (+ (term a) result))))
|
||
|
(iter a 0))
|
||
|
|
||
|
(sum (lambda (x) x) 0 (lambda (x) (+ x 1)) 3)
|