Functional Problem Solving (CSC 151 2015F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] [Remote Access]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Curtsinger (2015F)] [Davis (2013F)] [Rebelsky (2015S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Overview
let, let*cons, car, and cdr)image-computeif, when, and cond)How would you like to read a fanfic made by one of the most prominent friendly AI researchers in the entire world? And how would you like to learn about existential risk, rationality, and effective altruism through the medium of HARRY POTTER? (included at bottom of the email)
Check out the first chapter, and come to the first meeting (10/10) of Harry Potter and the Methods of Rationality club! Saturdays, 3pm in the CS commons.
We're hosting a hackathon for Spring 2016 that involves teaching people about the HPMOR fanfic through the medium of apps and websites.
There's a shared Google doc for comments
https://docs.google.com/document/d/1qwx7qn3I0GviOElEoTYVVLkVKgFBPB685HbyRPW1hQE/edit
Also, like the FB page to get updates.
https://www.facebook.com/HPMORHackathon?fref=ts
Contact [wuruth17] to get more information.
We've seen all of these, including repetition
map, image-variant, "that weird grid thing from HW 5",
image-compute.You are given a problem.
Task one: You get a LIST of employees, you have to determine if NAME is an employee
If the list is empty
return false
Otherwise, If (car lst) is "Sam"
return true
Otherwise
Ask your assistant if Sam is in the (cdr of the list)
Return whatever your executive assistant said
Task two: You get a list of employees, you want to determine how many employees you have, numEmployees(LIST)
If the list is empty
return 0
Otherwise
Ask your assistant to count the cdr of the list
Add 1
Task three: You get a list of employees, you want to determine how many employees have a name that starts with LETTER
If the list is empty
return 0
Otherwise, If the car of the list starts with LETTER
Ask your assistant to count the number of names that start with LETTER in the cdr of the list
Add 1 to that number
Otherwise
Ask your assistant to count the number of names that start with LETTER in the cdr of the list
Return that number
If the list is empty
return 0
Otherwise
Ask your assistant to count the number of names that start with LETTER in the cdr of the list
If your card starts with LETTER, add 1 to that number
Otherwise, just give back that number
Model
(define contains?
(lambda (lst name)
(cond
[(null? lst)
#f]
[(equal? (car lst) name)
#t]
[else
(contains? (cdr lst) name)])))