{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lec3 - CMPSC461:ProgrammingLanguage Concepts Lecture3...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPSC 461: Programming Language Concepts Lecture 3 Instructor: Prof. Swarat Chaudhuri
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Recursion, [email protected] n by n checkerboard Fibonacci: Fib(0) = 0 Fib(1) = 1 Fib(n) = Fib(n – 1) + Fib(n – 2) Sum of the first n natural numbers Sum of the all even numbers up to n The sum (1 + c + 2*c + 3*c + … + c*n) The sum (1 + c+ c 2 + c 3 + … + c n )
Background image of page 2
Anonymous [email protected] How annoying would be to give a name to every constant value? (define x 2) rather than just 2 So why are you expected to assign a name to every [email protected] you use??? In Scheme, anonymous [email protected] (lambda (x) exp) e.g., (lambda (x y) (* x y y)) a procedure that takes x, y and computes xy 2 .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Procedures are just data No basic difference between “foo” and 2 Well, ok, one thing is that “foo” doesn’t print
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '08
  • CHAUDHURI
  • Sumofthefirstnnaturalnumbers Sumoftheallevennumbersupton Thesum, Sumoftheallevennumbersupton Thesum, ProgrammingLanguage Concepts

{[ snackBarMessage ]}