;========
; Fall 2024 - CS 111
; Week 5 Lab Exercise
;
; date: 2024-09-27
;========

; make the definitions and functions from these modules available
;     in this file

(require 2htdp/image)
(require 2htdp/universe)

;========
; USING pair-programming:
; 1. COPY and PASTE the contents of this file into a 
;    DrRacket Definitions window
; 2. ADD comments and expressions TO THIS as specified below
;    (one student saying what to type, the other student typing it
;    into DrRacket)
;
;        ********
;    *   DO NOT DELETE THE COMMENTS! They speed up grading!
;        ********
;
; 3. RUN the resulting file frequently along the way, 
;    fixing any errors that arise, saving the 
;    Definitions window frequently, say as lab5.rkt
; 4. When you are done, use Gmail to MAIL a copy of 
;    the resulting filled-in lab5.rkt file to BOTH
;    of you
; 5. And, EACH of you should SUBMIT this file on
;    Canvas
;========

;=====
; Leave a blank line, and then put COMMENT(s) 
;     containing BOTH of your names:




;========
; PROBLEM 1 - PRACTICE writing expressions using list
;             functions
;
; YOU ARE NOT WRITING ANY NEW FUNCTIONS for this
;     problem -- you are practicing writing
;     list-related expressions!
;========
; Consider the following data definition comments:
;
;-----
; DATA DEFINITION
; an Anything is an expression of ANY type
;
;-----
; DATA DEFINITION:
; a list is one of:
;     - empty
;     - (cons Anything list) ; cons for CONStruct a list
;
;-----
; 1 part 1
;-----
; Write an expression whose value is the empty list.



;-----
; 1 part 2
;-----
; Decide on a theme/topic, and write an expression
;     ***USING cons***
;     whose value is a list of at least FOUR items
;     related to that theme/topic.




;-----
; 1 part 3
;----
; Now define a named constant, with an appropriate,
;     descriptive name, whose value is a list of at
;     least FOUR things related to that
;     theme topic, built ***USING cons***.
; (this can be a new list, or it can be the same list
;     you just gave for the previous answer)




;-----
; ...and now write a simple expression using your
;    new named constant:



;-----
; 1 part 4
;-----
; Consider the following data definition, and signature
;    and purpose for one of Racket's built-in list
;    functions:
;
;--------
; DATA DEFINITION:
; a NonEmptyList is one of:
;    - (cons Anything empty)
;    - (cons Anything NonEmptyList)
;
;-----
; signature: first: NonEmptyList -> Anything
; purpose: expects a non-empty list, and returns the
;    first item of that list
;
;-----
; Write an expression using Problem 1 part 3's named
;    constant list and the function first, whose value
;    will be the first thing in your named constant list



;-----
; 1 part 5
;-----
; Consider this signature and purpose for another of
;     Racket's built-in list functions:
;
;-----
; signature: rest: NonEmptyList -> list
; purpose: expects a non-empty list, and returns the
;    *list* of everything *except* the given list's
;    first element
;
;-----
; Write an expression using Problem 1 part 3's named
;    constant list and function rest, whose value will
;    be the the list of everything *except* the first
;    thing in your named constant list.



;-----
; 1 part 6
;-----
; How might you obtain the second element in a list?
; OK, Racket *does* provide some additional functions
;     second, third, and several more.
; BUT -- you can also use first and rest in creative
;     ways to do so, also.
;
;-----
; Decide which you want to try, and write an expression
;     using Problem 1 part 3's named constant list,
;     whose value will be the SECOND thing in your
;     named constant list.



;-----
; 1 part 7
;-----
; Write an expression using Problem 1 part 3's named
;     constant list, whose value will be the THIRD
;     thing in your named constant list.
;     (There is more than one reasonable way to do
;     this.)



;-----
; 1 part 8
;-----
; Write an expression using Problem 1 part 3's named
;     constant list, whose value will be the FOURTH
;     thing in your named constant list.
;     (There is more than one reasonable way to do
;     this.)



;-----
; 1 part 9
;-----
; Consider this signature and purpose for another of
;     Racket's built-in list functions:
;
;-----
; signature: length: list -> number
; purpose: expects a list, and returns the number of
;     (top-level) elements in that list
;
;-----
; Write an expression, using length, whose value will
;     be the length of an empty list.



;-----
; 1 part 10
;-----
; Write an expression using Problem 1 part 3's named
;    constant list and function length, whose value will
;    be the the number of items in your named
;    constant list.



;-----
; 1 part 11
;-----
; Consider this signature and purpose for another of
;     Racket's built-in list functions:
;
;-----
; signature: empty?: Anything -> boolean
; purpose: expects an expression of any type,
;     and returns whether it is an empty list
;
;-----
; Write an expression using Problem 1 part 3's named
;    constant list and function empty?, whose value
;    will show whether your named constant list is
;    empty or not. (That value had better be #false,
;    because your named constant list is NOT empty!)



;-----
; 1 part 12
;-----
; Consider this signature and purpose for another of
;     Racket's built-in list functions:
;
;-----
; signature: cons: Anything list -> list
; purpose: expects a desired value to add to the
;    beginning of a list, and a list to be added to,
;    and returns the list resulting from adding the
;    given desired value to the front of the given list
;
;-----
; Write an expression using Problem 1 part 3's named
;    constant list and function cons, whose result
;    will be to create a new list whose first item is
;    a value of your choice, followed by the contents of
;    Problem 1 part 3's named constant. 



;-----
; 1 part 13
;-----
; Define a named constant whose value is a list of at
;    least five *images*. (you may use *either* cons *or*
;    the shortcut list function for this)




;-----
; ...and now write a simple expression using your
;    new named constant:



;========
; PROBLEM 2 - a list function that *does not* need to
;             "walk through" everything in a list
;
; NOW you are writing a new function.
;========
; Using the DESIGN RECIPE, design a function
;    display-first, which expects a list of images,
;    and returns a scene of JUST the first
;    image in that list. If given an empty list,
;    it should return a scene with NO image added to it.
; (As the programmers, you get to decide where to
;    place that image in your scene; you also get to
;    decide the scene's width, height, and background.
;    Someone USING display-first ONLY gives a *list* of
;    images as its argument.)










;========
; PROBLEM 3 - big-bang with a list world
;========
; Write a big-bang expression with the following
; arguments:
; *   its initial value should be your named constant
;     list from Problem 1 part 13
; *   its to-draw expression should have display-first
;     as its argument
; *   its on-tick expression should have rest as its
;     first argument, and 1 as its 2nd argument
;     (asking big-bang's ticker to only tick
;     about 1 time per second)
; *   its stop-when clause should have empty? as
;     its argument

"remember to CLOSE the World window when big-bang ends!"





;=====
; Remember: once you have Run these and are satisfied
; with them,
; *   Use Gmail to EMAIL copies of this file to BOTH
;     of you
;
; *   BOTH of you should submit this file on Canvas
;=====