Created
November 17, 2011 04:05
-
-
Save GirlBossRush/1372341 to your computer and use it in GitHub Desktop.
Scheme stuff
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 sigma | |
(lambda (a form next b) | |
(if (> a b) | |
0 | |
(+ (form a) (sigma (next a) form next b))))) | |
(define sumsq | |
(lambda (m n) | |
(sigma m (lambda (k) (* k k)) (lambda (k) (+ k 1)) n))) | |
(define sumrep | |
(lambda (m n) | |
(sigma m (lambda (k) (/ 1 k)) (lambda (k) (+ k 2)) n))) | |
(define expo | |
(lambda (a b) | |
(if (= b 0) | |
1 | |
(* a (expo a (- b 1)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment