Skip to main content

Class 16: Making and Manipulating Lists of Drawings

Held: Friday, 17 February 2017

We explore Scheme’s *list data structure and some ways to use lists to make interesting images.*

Preliminaries

Overview

  • {“Context”=>”What and why lists?”}
  • Building lists
  • Mapping lists
  • Other list operations

Updates

News / Etc.

  • Continue partners!
  • I will go through a few issues quickly before the quiz.
  • You will likely need to finish today’s lab on your own, but I will be happy to answer questions about the lab via email or at the start of class on Monday.

Rotating reminders

  • Suggest extra credit! Send me extra credit ideas and opportunities. (Yes, this is a good way to get credit for some of the things you’re already planning to do.)

Upcoming Work

Extra credit (Academic/Artistic)

  • CS Table, Tuesday at noon, 21 Feb 2017. Net neutrality. Reading packets should be available outside Curtsinger’s office or Orsera’s office.
  • New Thursday extras, Thursday, 16 Feb 2017, 4:15 p.m., Science 3821: The Future of MathLAN
  • New Met Opera Live in HD showing of Rusalka, Saturday, Feb. 25. Talk 11:30-noon, opera noon-3pmish.
  • New Prazak Quartet, Tuesday, 28 February 2017, 7:30 p.m., Herrick.

Extra credit (Peer)

  • Friday-Saturday-Sunday, 17th-19th, Swimming and diving conference championships. (You can only get credit for two of the three days; staying for an hour counts.)
  • Saturday the 18th, Symphony Concert. 2-4 p.m. Sound painting and more! In Sebring-Lewis.
  • Art house print making and cookie decorating event. Saturday February 18th, 1-3PM on JRC 227.
  • Pun Club Saturday at 4pm in the Secret Younker 1st Floor Lounge Location. (You only get credit for this once.) (Moderation in all things.)

Good things to do

  • Women’s basketball (Senior day) next Saturday at 1pm.
  • Men’s basketball (Senior day) next Saturday at 3pm.
  • Slavic coffee house, Saturday, 5:30-7:00 p.m. Bucksbaum Rotunda.
  • Grinnell Equestrian Club Drill Team bake sale, 20 February 2017, 11am-2pm and 4pm-9pm.

Friday PSA

  • Plan and reflect.
  • Be moderate.
  • Get consent.

Context: What Are Lists?

  • Issue: We’d like to make images with lots and lots of similar shapes.
  • Problem: How to do so systematically.
  • Solution: Scheme’s list data structure and some related procedures.
  • We’re learning a new type, so it’s useful to figure out some basic issues.

Building Lists

  • (list val1 val2 ... valn)
  • (make-list n value)
  • (iota n)

Mapping Lists

  • Basic operation: (map func lst). Apply a function to each element of a list.
  • For images, we’ll find it easier to do something like
    (map drawing-transform list-of-drawings list-of-values)

Other List Operations

  • (append *lst1* *lst2*) - join two lists
  • (reverse *lst*) - just what it sounds like
  • (list-take *lst* *n*) - take the first n elements of a list
  • (list-drop *lst* *n*) - drop the first n elements of a list

Lab

  • Do the lab.
  • Be prepared to reflect.