Submit: Turn in your
hw2.scm
source file using the turnin command
on morbius.mscsnet.mu.edu or one of the
other Systems
Lab machines.
Work is to be completed in teams of two. Be certain to include both teammates names in the file. You may submit multiple times, but only the last turnin will be kept. The automatic submission system will not accept work after the deadline.
Include a comment block at the very top of each file that contains the following:
; COSC 3410 - Project 2
; Explain briefly the functionality of the program.
; @authors [your names]
; Instructor [your instructor]
; TA-BOT:MAILTO [your email addresses]
Your source file should be in the EoPL dialect ("#lang eopl" at top of file) supported by DrRacket, and should not make use of non-standard features like comment boxes that produce an XML file rather than a flat text .scm file.
This assignment makes use of the Binary Tree Demo from class. To
use these definitions for your assignment, download the Tree.scm
source file into the same directory as your hw2.scm
file. Include at the top of your file:
(require "Tree.scm")
Do not turnin Tree.scm with your assignment; I will provide my own copy when grading.
EoPL Exercise 2.21 (p.50). Implement the data type of environments, as in section 2.2.2, using define-datatype. Then include has-binding? of exercise 2.9.
Define a function "symbol-count" which takes a flat list of symbols and returns a list of lists in which each symbol is paired with the count of how many times it occurs in the original input. You should use your answers from Q1 to solve this problem.
Examples:
path : Int x BinaryTree(Int) → S-List
Usage: (path n t) = lst, a list of lefts and rights showing how to reach the node in t that contains n.
This problem relies upon the binary tree demonstration from lecture. See above.
[Revised 2021 Feb 05 11:32 DWB]