lecture-04 - CMSC-1610 Lecture 4 Administrative items 1...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC-1610 Lecture 4 Administrative items: 1) This year's lab 1 will probably be next year's lab 2. Sorry about that, my ambition got away from me, as it sometimes does. 2) Please make sure that your name is legible on your HW. I'm grading Monday's (so don't blame the TA), and I'm running late. Too much to do :-(. 3) The lab TA has prepared a survey we'd like you all to take. Today, we'll try to fix some of the damage from last time :-). Fun with lists. Recall lists: [1,2,3] :: [Int] List have two building blocks [] :: [a] -- the empty list, and (:) :: a -> [a] -> [a] -- cons, the list constructor. Thus, [1,2,3] is really 1 : 2 : 3 : [] Note that (:) associates to the right, which is kind. List processing is a core topic in functional programming. Why? Lists are very flexible data structures that enable us to deal with arbitrarily large data sets, and some very general, powerful tools have been developed for dealing with lists. E.g.: ++ :: [a] -> [a] -> [a] [1,2,3] ++ [4,5,6] => [1,2,3,4,5,6] filter :: (a -> Bool) -> [a] -> [a] filter even [0. .10] => [0,2,4,6,8,10] map :: (a -> b) -> [a] -> [b] map square [1. .4] => [1,4,9,16] concat :: [[a]] -> [a] concat [[1,2,3],[4,5],[],[6]] => [1,2,3,4,5,6] nub :: [a] -> [a] nub [1,2,1,2,3,2,3] => [1,2,3] You should understand them fully, and master their use.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Common exercises in intro lisp courses are to try to define these functions. E.g.,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/10/2009 for the course CMSC 16200 taught by Professor Kurtz during the Fall '09 term at UChicago.

Page1 / 4

lecture-04 - CMSC-1610 Lecture 4 Administrative items 1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online