Functional Problem Solving (CSC 151 2014S) : EBoards
Write a definition for the map procedure [5 points]
(define map (lambda (fun lst) (if (null? lst) null (cons (fun (car lst)) (map fun (cdr lst))))))
Write a function, squares, that, given n, computes the list (1 4 9 16 ... n^2) [5 points]
> (squares 5) '(1 4 9 16 25) > (squares 0) '() > (squares 3) '(1 4 9) (define squares (lambda (n) (map square (cdr (iota (+ n 1))))))
Something I should do differently/better in the fall * Respond more to labs. * Generally not enthusiastic about switching to "what were the big ideas of this lab" writeups, which were recommended by 207. * Do more physical demonstrations of algorithms * Optional "flipped" videos? Good for some, worry about work with others. Watch someone write the code. Talk about some of the small parts. * Don't force partners. Many people will learn more doing it on their own. * Distribute virtual machines earlier. * Focus on lab time. * Exams were challenging; maybe twice as many half as long?
Samuel A. Rebelsky, firstname.lastname@example.org
Copyright (c) 2007-2014 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)
This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.