#lang racket
(require loudhum)
(require 2htdp/image)

;;; File:
;;;   000000.rkt
;;; Authors:
;;;   The student currently referred to as 000000
;;;   Fahmida Hamid
;;;   Samuel A. Rebelsky
;;; Contents:
;;;   Code and solutions for Exam 1 2019S
;;; Citations:
;;;

;; +---------+--------------------------------------------------------
;; | Grading |
;; +---------+

;; This section is for the grader's use. Please do not remove it.

;; Problem 1: 
;; Problem 2:
;; Problem 3:
;; Problem 4:
;; Problem 5:
;;           ----
;;     Total:

;;    Scaled:
;;    Errors:
;;     Times:
;;          :
;;          :
;;          :
;;           ----
;;     Total:

;; +----------+-------------------------------------------------------
;; | Prologue |
;; +----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

;; +-----------+------------------------------------------------------
;; | Problem 1 |
;; +-----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

; Citations:

; Provided code

;;; Procedure:
;;;   grid-2x2
;;; Parameters:
;;;   make-image, a unary procedure
;;;   color1, a color
;;;   color2, a color
;;; Purpose:
;;;   Make a 2x2 grid of images of alternating colors.
;;; Produces:
;;;   two-by-two, an image
;;; Preconditions:
;;;   make-image takes a color as a parameter and returns an image.
;;; Postconditions:
;;;   two-by-two consists of four nearly identical images in a 2x2 grid.
;;;   The top-left and bottom-right images are color1.  The top-right
;;;   and bottom-left images are color2.
(define grid-2x2
  (lambda (make-image color1 color2)
    (above
     (beside (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1)))))

; Solution:

;;; Procedure:
;;;   grid-16x16
;;; Parameters:
;;;   make-image, a unary procedure
;;;   color1, a color
;;;   color2, a color
;;; Purpose:
;;;   Make a 16x16 grid of images of alternating colors.
;;; Produces:
;;;   excessive, an image
;;; Preconditions:
;;;   make-image takes a color as a parameter and returns an image.
;;; Postconditions:
;;;   excessive consists of 256 different images of alternating
;;;   colors, arranged in a 16x16 grid.
(define grid-16x16
  (lambda (make-image color1 color2)
    (above
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1))
     (beside (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2))
     (beside (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1) (make-image color2) (make-image color1)))))

; Examples/Tests:
#|

|#

;; +-----------+------------------------------------------------------
;; | Problem 2 |
;; +-----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

; Citations:

; Solution:

;;; Procedure:
;;;   sublist
;;; Parameters:
;;;   lst, 
;;;   start,
;;;   end, 
;;; Purpose:
;;;   
;;; Produces:
;;;   
;;; Preconditions:
;;;   
;;; Postconditions:
;;;   
(define sublst
  (lambda (lst start end)
    null)) ; STUB

; Examples/Tests:
#|

|#

;; +-----------+------------------------------------------------------
;; | Problem 3 |
;; +-----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

; Citations:

; Solution:

; a, b, d.

;;; Procedure:
;;;   
;;; Parameters:
;;;
;;; Purpose:
;;;   
;;; Produces:
;;;   
;;; Preconditions:
;;;   
;;; Postconditions:
;;;   
(define
  :/ (o                                            
         (section reduce string-append <>)
                                                   (lambda 
     (                                            
  :-)     (map (o string (section string-ref
  :- <>) (section - (string-length
  :-)                                   <> 1)) (range (string-length
  :-)
                                                      ))))) 

; c.

#|
Put your explanation here
|#

; Examples/Tests:

#|

|#

;; +-----------+------------------------------------------------------
;; | Problem 4 |
;; +-----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

; Citations:

; Solution:

;;; Procedure:
;;;   describe-number
;;; Parameters:
;;;   num, a number
;;; Purpose:
;;;   Provide a human-readable description of num.
;;; Produces:
;;;   description, a string
(define describe-number
  (lambda (num) 
    "pretty")) ; STUB

; Examples/Tests:
#|

|#

;; +-----------+------------------------------------------------------
;; | Problem 5 |
;; +-----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

; Citations:

; Solution:

; a.

;;; Procedure:
;;;   markdown-code
;;; Parameters:
;;;   str, a string
;;; Purpose:
;;;   Convert the "code" mark in str to HTML tags.
;;; Produces:
;;;   html, a string
(define markdown-code
  (lambda (str)
    str)) ; STUB

; b.

;;; Procedure:
;;;   markdown-emphasize
;;; Parameters:
;;;   str, a string
;;; Purpose:
;;;   Convert the "emphasize" marks in str to HTML tags.
;;; Produces:
;;;   html, a string
(define markdown-emphasize
  (lambda (str)
    str)) ; STUB

; c.

;;; Procedure:
;;;   markdown-headings
;;; Parameters:
;;;   str, a string
;;; Purpose:
;;;   Convert the "heading" marks in str to HTML tags.
;;; Produces:
;;;   html, a string
(define markdown-headings
  (lambda (str)
    str)) ; STUB

; d.

;;; Procedure:
;;;   markdown-paragraphs
;;; Parameters:
;;;   str, a string
;;; Purpose:
;;;   Mark the paragraphs in str as such.
;;; Produces:
;;;   html, a string
(define markdown-paragraphs
  (lambda (str)
    str)) ; STUB

; e.

;;; Procedure:
;;;   markdown
;;; Parameters:
;;;   str, a string
;;; Purpose:
;;;   Convert str from markdown to HTML.
;;; Produces:
;;;   html, a string
(define markdown
  (lambda (str)
    str)) ; STUB

; Examples/Tests:
#|

|#

;; +-----------+------------------------------------------------------
;; | Problem 6 |
;; +-----------+

; Time Log:
;   Date        Start   Finish  Elapsed Activity

; Time Spent: 

; Citations:

; Solution:

; a.

;;; Procedure:
;;;   proper-names
;;; Parameters:
;;;   strings, a list of strings
;;; Purpose:
;;;   Extract the proper names from strings
;;; Produces:
;;;   names, a list of strings
;;; Preconditions:
;;;   [No additional]
;;; Postconditions:
;;;   * All strings in names appear in strings, and in the same order.
;;;   * All strings in names begin with an uppercase letter and contain
;;;     only letters.
;;;   * Any string in strings that begins with an uppercase letter and
;;;     contains only letters appears in names.
(define proper-names
  (lambda (strings)
    strings)) ; STUB

; b. 

;;; Procedure:
;;;   add-name
;;; Parameters:
;;;   name, a string
;;;   names, a string
;;; Purpose:
;;;   Add name to the front of names, provided it is not already at
;;;   the front of names.
;;; Produces:
;;;   new-names, a string
;;; Preconditions:
;;;   [No additional]
;;; Postconditions:
;;;   * If name appears at the front of names, new-names = names.
;;;   * If name does not appear at the front of names, new-names
;;;     = (string-append name " " names).
(define add-name
  (lambda (name names)
    (string-append name " " names))) ; STUB

; c.

;;; Procedure:
;;;   unique-proper-names
;;; Parameters:
;;;   strings, a list of strings
;;; Purpose:
;;;   Extract the proper names from strings, with no name appearing
;;;   more than once.
;;; Produces:
;;;   names, a list of strings
;;; Preconditions:
;;;   [No additional]
;;;   * All strings in names appear in strings, although not necessarily
;;;     in the same order.
;;;   * All strings in names begin with an uppercase letter and contain
;;;     only letters.
;;;   * Any string in strings that begins with an uppercase letter and
;;;     contains only letters appears in names.
;;;   * No string appears twice in names
(define unique-proper-names
  (lambda (strings)
    (proper-names strings))) ; STUB

; Examples/Tests:
#|

|#

