=====
CS 111 - Week 5 Lecture 2 - 2024-09-26
=====
=====
TODAY WE WILL:
=====
* announcements
* intro to the idea of a DATA STRUCTURE
* intro to Racket's list data type
* prep for next class
* should be working on Homework 4!
* at-least-first-attempts in by 11:59 pm TOMORROW
* submit frequently!
=====
* a DATA STRUCTURE lets us have a SINGLE thing that
contains MULTIPLE instances within a single
collection-thing:
* a LIST of items!
* a STACK of items!
* an ARRAY of items!
* a TREE of items!
* a TABLE of items!
ETC.!!
* our FIRST data structure will be
BSL Racket's list data type
* note for the future:
choosing an appropriate data structure for a problem
makes writing a program for tht problem easier --
Fred Brooks:
"Representation is the essence of programming."
=====
BSL Racket list data type
=====
* the list data type is built into Racket;
* BSL Racket's list follows this data definition:
DATA DEFINITION:
a list is one of:
* empty
* (cons Anything list)
^ self-reference
* interesting things about this definition:
* a list can be empty!
* a list doesn't have a set pre-determined size
* a list can contain items of any, of different, types
* a list is defined self-referentially
* see more about Racket list type,
and some of its available built-in functions,
in today's Racket file