540 likes | 546 Views
Join us for an introduction to the Scheme programming language, its history, and why it's worth learning. Dive into the fundamentals of computational thinking, Towers of Hanoi problem, recursion, and more. Discover the advantages of Scheme over other languages and explore topics like dynamic programming and data abstraction. This course is suitable for beginners and experienced programmers alike. Get ready to expand your programming skills and think outside the box!
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
Brief History • Scheme was developed at MIT in 1975 to teach programming methodology • First introduced at NUS 13 years ago • I took this class at MIT in 1994.
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) #t) (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
Caveat • To enroll in CS1101S, min requirement of A grade for ‘A’ Level Math or equivalent. • Or you can appeal at Undergrad Office
like ?
Scheme vs C • Who would you marry? • Pretty but poor? • Rich but ugly?
10 Reasons NOTto take CS1101S • If you hate Math • If you don’t like challenges • If you cannot manage self-studying and need to be spoonfed • If you just want to get a free A • If you are not interested in learning more
10 Reasons NOTto take CS1101S • If you don’t like personalised attention • If you don’t wish to meet like-minded peers • If you don’t care about applying your knowledge • If you don’t take shocks well/if you fear evilness • If you don’t like shuai prof :P
Google is your Friend “cs1101s midterm review”