Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

scheme file #lang scheme ; Scheme Poject test module ; YOU SHOULD NOT MODIFY THIS FILE! If one of your functions does not work ;

scheme file
#lang scheme
; Scheme Poject test module
; YOU SHOULD NOT MODIFY THIS FILE! If one of your functions does not work
; comment out the call to the test module in your code.
; Your code will be tested with a similar module
(provide test-remove-next-to-last)
(provide test-manhattan)
(provide test-remove-dups)
(provide test-deep-search)
(provide test-inorder)
(provide test-tree-exists)
(provide test-eval-poly)
(provide test-get-poly-fun)
(display "Summer 2024 Test Cases")(newline)
(define test-remove-next-to-last
(lambda (x)
(begin
(display "Question 1: remove-next-to-last: ")
(write (x '(l a s x t)))(display " & ")
(write (x '(o n x e)))
(newline)
)))
(define test-manhattan
(lambda (x)
(begin
(display "Question 2: manhattan: ")
(write (x '(-1.4)'(1.8)))(display " & ")
(write (x '(-4.-3)'(6.3)))(display " & ")
(write (x '(-2.-2)'(5.5)))
(newline)
)))
(define test-remove-dups
(lambda (x)
(begin
(display "Question 3: remove-dups: ")
(write (x '(w o r k s)))(display " & ")
(write (x '(p p p p e e e r r r r r f f f f f e e e e c c c t t t t)))(display " & ")
(write (x '(T T T T T T T T T T T)))
(newline))))
(define test-deep-search
(lambda (x)
(begin
(display "Question 4: deep-search ")
(write (x 22))(display " & ")
(write (x '(12345)3))(display " & ")
(write (x '(12345)7))(display " & ")
(write (x '(1(2(3)45))4))(display " & ")
(write (x '(a (b (c (d (e)))))'e))(display " & ")
(write (x '(1(2(34))(5)((67(8)))9)13))
(newline)
)))
(define tree1'((1.3).((4.5).(8.9))))
(define tree2'((1.(2.3)).(((4.6).7).(8.(9.10)))))
(define test-inorder
(lambda (x)
(begin
(display "Question 5: inorder: ")
(write (x tree1))(display " & ")
(write (x tree2))
(newline)
)))
(define test-tree-exists
(lambda (x)
(begin
(display "Question 5: tree-exists: ")
(write (x tree15))(display " & ")
(write (x tree110))(display " & ")
(write (x tree25))(display " & ")
(write (x tree210))
(newline)
)))
(define test-eval-poly
(lambda (x)
(let ((poly1'((1.1)(1.1)(1.0)))
(poly2'((1.4)(-3.2)(3.1)(6.0)))
(poly3'((1.4)(2.3)(1.2)(3.1)(5.0))))
(begin
(display "Question 6a: eval-poly: ")(newline)
(display " Poly1: ")
(write (x poly11))(display " & ")
(write (x poly1-2))(display " & ")
(write (x poly14))
(newline)
(display " Poly2: ")
(write (x poly21))(display " & ")
(write (x poly2-2))(display " & ")
(write (x poly24))
(newline)
(display " Poly3: ")
(write (x poly31))(display " & ")
(write (x poly3-2))(display " & ")
(write (x poly34))
(newline)
))))
(define test-get-poly-fun
(lambda (x)
(let ((poly1'((1.1)(1.1)(1.0)))
(poly2'((1.4)(-3.2)(3.1)(6.0)))
(poly3'((1.4)(2.3)(1.2)(3.1)(5.0))))
(let
((f1(x poly1))
(f2(x poly2))
(f3(x poly3)))
(begin
(display "Question 6b: get-poly-fun: ")
(write (x poly1))(display " & ")
(write (x poly2))
(newline)
(display " f1: ")
(write (f11))(display " & ")
(write (f1-2))(display " & ")
(write (f14))(newline)
(display " f2: ")
(write (f21))(display " & ")
(write (f2-2))(display " & ")
(write (f24))(newline

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Evaluate each of the following. $ 100 (1 + 0.06 45 365)

Answered: 1 week ago

Question

Excel caculation on cascade mental health clinic

Answered: 1 week ago

Question

In what context did the study and teaching of communication begin?

Answered: 1 week ago