Skip to content

Instantly share code, notes, and snippets.

@GirlBossRush
Created November 17, 2011 04:05
Show Gist options
  • Save GirlBossRush/1372341 to your computer and use it in GitHub Desktop.
Save GirlBossRush/1372341 to your computer and use it in GitHub Desktop.
Scheme stuff
(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