solutions/Structure and Interpretatio.../sicp-ex-1.30.rkt

12 lines
226 B
Racket
Raw Normal View History

2024-04-16 19:13:00 -04:00
#! /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)