570 likes | 587 Views
Welcome to the Scheme programming language developed at MIT in 1975, introduced at NUS 14 years ago. Explore the basics of Scheme, from prefix notation to expressive programming. Learn about recursive thinking, computational methodologies, and how to solve complex problems like the Towers of Hanoi. This course covers fundamental concepts of computer programming and introduces advanced topics like memoization, object-oriented programming, and dynamic programming. Get ready to dive into the world of Scheme with CS1101S or CS1010!
E N D
Welcome to SoC!
CS1101S or CS1010? why are you here?
DDP folks You can sleep
Turing Programme Yes, you also can sleep
Scheme Developed at MIT in 1975 to teach programming methodology
1994 Scheme Introduced at NUS 14 years ago
8 (+ 5 3) (- (+ 5 3) (* 2 3)) 2 prefix notation
11 (+ 5 6) (define a 5) (+ a 6) 11
Scheme is Expressive (define (square x) (* x x)) To square something, multiply it by itself (square 2) (square (square 3)) 4 36 81
Congratulations! You know Scheme
Simple (didn’t you just learn it in 10 mins? )
Futile to Teach a Language (Here today, gone tomorrow)
Can you solve this for 1,000 discs?
What if we have no discs? Do nothing!
Towers of Hanoi A B C Suppose we know how to move 3 discs from A to C
Towers of Hanoi A B C Suppose we know how to move 3 discs from A to C
Towers of Hanoi A B C Claim: we can move 3 discs from A to B. Why?
Towers of Hanoi A B C Claim: we can move 3 discs from A to B. Why?
Towers of Hanoi A B C What do we do for 4 discs?
Towers of Hanoi (define (move-tower size from to extra) (cond ((= size 0) ’do-nothing) (else (move-tower (- size 1) from extra to) (print-move from to) (move-tower (- size 1) extra to from)))) from extra to
Towers of Hanoi (define (print-move from to) (newline) (display "move top disk from ") (display from) (display " to ") (display to))
Java CS1101S Road Map Memoization Streams ADVANCED Dynamic Programming Object-Oriented Programming INTERMEDIATE Symbolic Data Higher-Order Procedures Generic Operators List Processing BASIC Mutation & State Data Abstraction Procedural Abstraction Iteration Recursion Wishful Thinking Order of Growth Fundamental concepts of computer programming
Puke Test
Scheme vs C • Who would you marry? • Pretty but poor? • Rich but ugly?
Google is your Friend “cs1101s midterm review”