+ All Categories
Home > Documents > A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Date post: 04-Jan-2016
Category:
Upload: reginald-hoover
View: 220 times
Download: 5 times
Share this document with a friend
35
A Scheme A Scheme Workshop Workshop Ben Leong Ben Leong NUS School of Computing NUS School of Computing 31 July 2007 31 July 2007
Transcript
Page 1: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

A Scheme WorkshopA Scheme Workshop

Ben LeongBen LeongNUS School of ComputingNUS School of Computing

31 July 200731 July 2007

Page 2: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Welcome to SoCWelcome to SoC

Help you make an informed Help you make an informed decision on whether to choose decision on whether to choose between CS1101 and CS1101Sbetween CS1101 and CS1101S

NOTNOT to teach you Scheme to teach you Scheme About which class is About which class is more more

suitablesuitable for for YOUYOU

NOTNOT about which is better…. about which is better….

Page 3: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

OverviewOverview

What’s Scheme?What’s Scheme? Why Scheme?Why Scheme? Module SynopsisModule Synopsis

(i.e. what to expect)(i.e. what to expect) What your seniors sayWhat your seniors say

Page 4: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Brief History of CS1101SBrief History of CS1101SThe language Scheme was designed 25 The language Scheme was designed 25

years ago at MIT to teach programming years ago at MIT to teach programming methodologymethodology

The success of the MIT programming The success of the MIT programming methodology module led to its adoption in methodology module led to its adoption in many universities worldwidemany universities worldwide

Scheme was first introduced at NUS Scheme was first introduced at NUS 1010 years agoyears ago

I took this class at MIT in I took this class at MIT in 19941994. .

Page 5: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

ObjectivesObjectives

Teach Scheme as a programming language Teach Scheme as a programming language

Teach programming conceptsTeach programming concepts Inspire CONFIDENCE in students that Inspire CONFIDENCE in students that

ANYTHING can be solved if they try hard ANYTHING can be solved if they try hard enoughenough

Teach students Teach students

Computational ThinkingComputational Thinking

TO THINK TO THINK

NOT!NOT!

Page 6: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Introduction to SchemeIntroduction to Scheme

Scheme is expression oriented. Type an Scheme is expression oriented. Type an expression and its result will be printed expression and its result will be printed out.out.

Works with a variety of types of numbers: Works with a variety of types of numbers: integers (both positive and negative), integers (both positive and negative), fractions (rational numbers), and real fractions (rational numbers), and real numbersnumbers

Page 7: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Introduction to SchemeIntroduction to Scheme

Expressions use prefix notation.Expressions use prefix notation.Use Use (+ 2 3)(+ 2 3) instead of instead of (2 + 3)(2 + 3)Use Use (* (+ 2 3) (- 3 1))(* (+ 2 3) (- 3 1)) instead of instead of (2+3)*(3-1)(2+3)*(3-1)

There is a wealth of predefined There is a wealth of predefined functionsfunctionssqrtsqrt computes the square root of its computes the square root of its

argument.argument.+ + is also a predefined functionis also a predefined function

Page 8: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Why Scheme?Why Scheme?

Teaching a language is futileTeaching a language is futile(Here today, gone tomorrow)(Here today, gone tomorrow)

Scheme is simple as a languageScheme is simple as a languageSo we can focus on the So we can focus on the

CONCEPTSCONCEPTS instead of instead of clunky clunky language ruleslanguage rules

Let’s see for ourselves…..Let’s see for ourselves…..

Page 9: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

RecursionRecursion

Express (divide) a problem into Express (divide) a problem into smaller similar problemssmaller similar problems

Solve the problem for a simple Solve the problem for a simple (base) case(base) case

We are done (!)We are done (!)Similar to Similar to

Mathematical InductionMathematical Induction

Page 10: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

The Towers of HanoiThe Towers of HanoiWe have 3 pegs and a set of discs, all of different diameters.

Objective: move the pile of discs to last peg, by: moving 1 disc at a time from 1 peg to another; never placing a disk on top of another disc with

smaller diameter.

Suppose you have not 3, but Suppose you have not 3, but nn discs … discs …

Page 11: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

The Towers of HanoiThe Towers of Hanoi

We must start somewhere….Suppose we have one disc ….What if there are no discs?

Nothing to do!Base case

Page 12: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

The Towers of HanoiThe Towers of Hanoi

We notice the following pattern: if we want to move n disks from peg a to peg c using peg b as intermediary storage, then we:assume we know how to move n−1 disks to peg

b, using peg c as intermediary storage;we move disk n from a to c ;we move n−1 disks from b to c, using a as

intermediary storage.

RECURSIONRECURSION

Page 13: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

The Towers of HanoiThe 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))))

(define (print-move from to)

(newline)

(display "move top disk from ")

(display from)

(display " to ")

(display to))

Page 14: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

CS1101S: Programming CS1101S: Programming Methodology Methodology (Scheme)(Scheme)

Lectures: Lectures: Wed 10am-12pm, Fri 11am-12pm, LT15Wed 10am-12pm, Fri 11am-12pm, LT15Recorded for webcastRecorded for webcast

Recitations: 1 hr/wkRecitations: 1 hr/wkTwo or three groups: Prob Thurs, Venue Two or three groups: Prob Thurs, Venue

TBATBADiscussion Groups: 2 hr/wkDiscussion Groups: 2 hr/wk

Three or four groups: TBAThree or four groups: TBABid for group in CORSBid for group in CORS

Page 15: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Teaching StaffTeaching Staff

Lecturer: Dr. Ben Leong, Lecturer: Dr. Ben Leong, [email protected]@comp.nus.edu.sgOffice: S14 #06-14Office: S14 #06-14

Phone: 6516-4240Phone: 6516-4240

Hours: TBA, or by appointmentHours: TBA, or by appointment Undergraduate Discussion Group Undergraduate Discussion Group

LeadersLeaders

Page 16: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Syllabus (in Brief)Syllabus (in Brief) Numeric computations in Scheme Building recipes with functions Recursion Data structures: lists, trees Memoization & Dynamic Programming Generic operations Object oriented abstractions Java

Covers core concepts of computer Covers core concepts of computer programmingprogramming

Page 17: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Textbook : Textbook : SICPSICP

FREE!!FREE!! Available online at Available online at

http://mitpress.mit.edu/sicp/full-http://mitpress.mit.edu/sicp/full-text/book/book.htmltext/book/book.html

Page 18: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Supplementary Supplementary TextText

ALSO FREE!!ALSO FREE!! Available online at Available online at

http://gustavus.edu/+max/conchttp://gustavus.edu/+max/concrete-abstractions-pdfs/index.htrete-abstractions-pdfs/index.htmlml

Page 19: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Scheme InterpreterScheme Interpreter

We will be using DrSchemeWe will be using DrScheme It’s FREE!!!It’s FREE!!!Download from:Download from:

http://www.drscheme.org/http://www.drscheme.org/

Page 20: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Assessment OverviewAssessment Overview

Tutorial participation: Tutorial participation: 10%10%Problem sets: Problem sets: 30%30%Midterm exam: Midterm exam: 15%15%

3 Oct 2007 (Wed) 10am-12 pm3 Oct 2007 (Wed) 10am-12 pmPractical exam:Practical exam: 15%15%

7 Nov 2007 (Wed) 10am-12 pm7 Nov 2007 (Wed) 10am-12 pm

Final exam: Final exam: 30%30%

26 Nov 2007 (Mon) Morning26 Nov 2007 (Mon) Morning

Page 21: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Tutorial Participation (10%)Tutorial Participation (10%)

Questions will usually be given out prior to Questions will usually be given out prior to the recitations/discussion groups, the recitations/discussion groups, sometimes notsometimes not

Assessed mainly by tutors, with some inputs Assessed mainly by tutors, with some inputs from lecturer from interactions during from lecturer from interactions during recitations & lecturesrecitations & lectures

You need to be active, participate by You need to be active, participate by offering solutions, making comments and offering solutions, making comments and asking questions.asking questions.

Page 22: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Midterm and Final ExamsMidterm and Final Exams (15% + 30%) (15% + 30%)

Standard fare – 2 hours eachStandard fare – 2 hours eachWill test concepts, Will test concepts, NOTNOT memory memoryOpen-sheet Open-sheet

1 x A4 sheet of notes allowed for midterm1 x A4 sheet of notes allowed for midterm2 x A4 sheet of notes allowed for finals2 x A4 sheet of notes allowed for finals

Sample midterms available on IVLESample midterms available on IVLESample finals available from LibrarySample finals available from Library

Page 23: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Problem Sets (30%)Problem Sets (30%)

Seven problem setsSeven problem setsDue approximately once every two Due approximately once every two

weeksweeksGraded by the Undergraduate Tutors Graded by the Undergraduate Tutors Crucial for learning the material in this Crucial for learning the material in this

classclassThis is effectively the lab component of This is effectively the lab component of

the classthe class

Page 24: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Practical Exam (15%)Practical Exam (15%)

““Test of the Pudding”Test of the Pudding”

At the completion of Scheme At the completion of Scheme syllabussyllabus

2 hours to solve three programming 2 hours to solve three programming problems of increasing difficultyproblems of increasing difficulty

Sample exams available on IVLESample exams available on IVLE

Page 25: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Other HighlightsOther Highlights

Will build a Lego Mindstorm robot in the Will build a Lego Mindstorm robot in the middle of the Semestermiddle of the Semester

Regular Programming Contests to keep Regular Programming Contests to keep students challengedstudents challenged

Page 26: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

CS1101S vs. CS1101CS1101S vs. CS1101

Progression: CS1101S Progression: CS1101S CS1102S CS1102S CS1101 CS1101 CS1102 CS1102

Two-semester sequenceTwo-semester sequenceDiscouraged from crossing overDiscouraged from crossing overCS1101S CS1101S CS1102, CS1101 CS1102, CS1101 CS1102S CS1102S

SimilaritiesSimilaritiesS and non-S versions both teach basic S and non-S versions both teach basic

programming principlesprogramming principles

Page 27: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

CS1101S/02S vs. CS1101/02CS1101S/02S vs. CS1101/02

DifferencesDifferencesCS1101S/02S cover more advanced CS1101S/02S cover more advanced

topicstopicsMore challengingMore challengingCS1102S covers Java + moreCS1102S covers Java + moreGood introduction to many computer Good introduction to many computer

science topicsscience topics

Page 28: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Which to take?Which to take?Take CS1101S/02S if you want to be Take CS1101S/02S if you want to be

challenged.challenged. If you have programmed beforeIf you have programmed before

No real advantageNo real advantage In fact, can be a disadvantage!In fact, can be a disadvantage!

If you have never programmed beforeIf you have never programmed beforeGreat! You are not at a disadvantage.Great! You are not at a disadvantage.Keep an open mind.Keep an open mind.

Some evidence show that female students Some evidence show that female students cope better with Scheme than Java.cope better with Scheme than Java.

Page 29: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Java vs Scheme: Java vs Scheme: What’s the Tradeoff?What’s the Tradeoff?

Java: sophisticated, mature can be used for commercial applications but has many underlying concepts that a beginner

may find hard to understand

Scheme: simple, elegant easy to learn (hard to master) designed to illustrate the concepts will eventually learn Java anyway….

Mainly a question of personal choice (taste?)

Page 30: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

What your seniors say….What your seniors say….

I think Scheme really does bring about concepts easily. I think Scheme really does bring about concepts easily. Java's messy, so messy for an amateur programmer. Java's messy, so messy for an amateur programmer.

(on Problem Sets) They are all very difficult, but some are (on Problem Sets) They are all very difficult, but some are killers. killers.

I learnt a tiny bit of java before I attended this class and I I learnt a tiny bit of java before I attended this class and I was totally lost. Teaching introduction to programming in was totally lost. Teaching introduction to programming in Scheme is a quite smart idea. I feel much better when I Scheme is a quite smart idea. I feel much better when I came back to Java at the end of this class. came back to Java at the end of this class.

[What doesn’t kill you makes you strong][What doesn’t kill you makes you strong]

Page 31: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

What your seniors say….What your seniors say….

I was warned by my seniors not to take scheme I was warned by my seniors not to take scheme because they said it was very tough .... now when because they said it was very tough .... now when I’ve done this module , I agree that it is tough.. but I’ve done this module , I agree that it is tough.. but it is worth the effort ..scheme makes u smarter !!! :) it is worth the effort ..scheme makes u smarter !!! :)

Do you agree that Scheme is easier than Java? Do you agree that Scheme is easier than Java? 32% NO; 68% YES! 32% NO; 68% YES!

Luv the class, luv the company of students, luv the Luv the class, luv the company of students, luv the interaction with teachers, bla bla bla... Scheme's interaction with teachers, bla bla bla... Scheme's coolcool

I think we need more classmates I think we need more classmates

Page 32: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

More comments here ….More comments here ….

http://www.comp.nus.edu.sg/~bleong/http://www.comp.nus.edu.sg/~bleong/teaching/cs1101s06-midterm.htmteaching/cs1101s06-midterm.htm

http://www.comp.nus.edu.sg/~bleong/http://www.comp.nus.edu.sg/~bleong/teaching/cs1101s06-final.htmteaching/cs1101s06-final.htm

Just Google “Just Google “cs1101s survey”!!!cs1101s survey”!!!

Page 33: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

Words of AdviceWords of Advice

Don’t worry about the curveDon’t worry about the curveScheme is easier (or so I would claim), Scheme is easier (or so I would claim),

but doesn’t mean that CS1101S is an but doesn’t mean that CS1101S is an easier classeasier class

Take CS1101S still have to learn Take CS1101S still have to learn Java…. so it is definitely more work Java…. so it is definitely more work

Have to be prepared to work Have to be prepared to work veryvery hard hard in CS1101Sin CS1101S

Page 34: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

QUESTIONSQUESTIONS

Page 35: A Scheme Workshop Ben Leong NUS School of Computing 31 July 2007.

THANKTHANKYOUYOU


Recommended