Created
July 22, 2012 16:38
-
-
Save taiki45/3160239 to your computer and use it in GitHub Desktop.
Sample program for STS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (enum-nums proc init limit) | |
(if (> init limit) | |
'() | |
(cons init (enum-nums proc (proc init) limit)))) | |
(define (accumulate op init seq) | |
(if (null? seq) | |
init | |
(+ (car seq) (accumulate op init (cdr seq))))) | |
(accumulate + 0 (enum-nums (lambda (n) (+ 1 n)) 1 100)) | |
(accumulate * 1 (enum-nums (lambda (n) (+ 2 n)) 1 10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment