Functional Problem Solving (CSC 151 2015S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] - [Calendar]
Current: [Assignment] [EBoard am] [EBoard pm] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards am] [EBoards pm] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014F)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Book Office Hours] - [Issue Tracker (Course)]
Overview
I did not take time last week to condemn the postings on Yik Yak because I thought the president's statement sufficed. But it sounds like individual voices are necessary, too. And, as a technologist, I have particular responsibility to comment in this case. So I should have done so more promptly. I apologize for the delay, particularly because this issue is very important to me.
Let me make it absolutely clear. Use of any medium - social, physical, virtual - to denigrate other people for their characteristics is completely unacceptable. I have updated our course front door to clarify this perspective. (If you have comments on how to better phrase my policy, I would appreciate them.)
How should we ask whether a list has one element?
(null? (cdr lst))Do not use
(= 1 (length lst))!
When will we get the quizzes back?
Wednesday, I hope. Otherwise Monday.
One of the mentors wants to see you write riffle, which is the last
problem in the extras session.
I don't care what value you give for (product null), so choose
whatever is most helpful for you.
There are at least six different correct answers I've seen for
irgb-tally-darks.
Two approaches to product
(define product
(lambda (lst)
(if (null? lst)
1
(* (car lst) (product (cdr lst))))))
(define product
(lambda (lst)
(if (null? (cdr lst))
(car lst)
(* (car lst) (product (cdr lst))))))
Two ways to code riffle
(define riffle
(lambda (first second)
(cond
[(null? first) second]
[(null? second) first]
[else (cons (car first)
(cons (car second)
(riffle (cdr first) (cdr second))))])))
(define riffle
(lambda (first second)
(if (null? first)
second
(cons (car first)
(riffle second (cdr first))))))