-
-
Save dahlia/3175089 to your computer and use it in GitHub Desktop.
Higher-order function test suite
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 sum (make-aggregate + 0)) | |
(sum (list 1 2 3)) ; 6 | |
(define product (make-aggregate * 1)) | |
(product (list 2 3 4)) ; 24 | |
(define sum2 (make-aggregate (lambda (a b) (+ a b)) 0)) | |
(sum2 (list 1 2 3)) ; 6 | |
(define product2 (make-aggregate (lambda (a b) (* a b)) 1)) | |
(product2 (list 2 3 4)) ; 24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment