Functional Problem Solving (CSC 151 2014S) : EBoards

CSC151.02 2014S, Class 36: Pairs and Pair Structures


Overview

Preliminaries

Upcoming Work

Admin

Questions

Can you talk about backslashes in strings and characters?

Characters. Problem: Distinguish the character a from the string a from the symbol a from the name a. Scheme decided: characters #\a, "a", 'a, a.

Strings. Sequences of characters surrounded by double-quotation marks. "KimS is so excited." If quotation marks appear within a string, preface them with a backslash. "Kim S says \"I'm so excited!\"" And when things are in quotation marks, you don't need the #.

Whoops. Backslash has a special meaning. So .... to represent backslash in a string, write \. This lets us distingish "\" "\""

What does (list-drop lst n) do?

Creates a new list by removing the first n elements of lst. You can also think of this as (cdr (cdr (cdr ... (cdr lst)))), with n calls to cdr.

Quiz

Wasn't that fun?

Representing lists: Pairs and cons cells

Why care about the underlying representation?

Lab

Correction: NO LAB WRITEUP!


Samuel A. Rebelsky, rebelsky@grinnell.edu

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.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.