100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Summary

Summary CPSC 110 PSET 2 SOLUTIONS

Rating
-
Sold
3
Pages
4
Uploaded on
11-07-2021
Written in
2020/2021

L CPSC 110 PSET 2 SOLUTIONS

Institution
Module








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Module

Document information

Uploaded on
July 11, 2021
Number of pages
4
Written in
2020/2021
Type
Summary

Subjects

Content preview

;; The first three lines of this file were inserted by DrRacket. They record
metadata
;; about the language level of this file in a form that our tools can easily
process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname pset-02-solution) (read-
case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-
decimal #t #t none #f () #t)))
;; DO NOT PUT ANYTHING PERSONALLY IDENTIFYING BEYOND YOUR CWL IN THIS FILE.
;; YOUR CWLs WILL BE SUFFICIENT TO IDENTIFY YOU AND, IF YOU HAVE ONE, YOUR
;; PARTNER.
;;
(require spd/tags)
(require 2htdp/image)

(@assignment pset-02);Do not edit or remove this tag
(@cwl ??? ???) ;Replace ??? with your cwl,
;; ;second ??? is replaced with partner cwl if you have one


(@problem 1)
;;
;; The following function design may have errors in it. Please fix the error
;; or errors that you find. Any changes you make should preserve the existing
;; design intent.
;;
;; First uncomment the entire function design, and then fix the error.
;; If you are unable to find and fix the error, leave it commented out.
;; Note that when fixing a bug in an existing program your goal should
;; be to have a light touch. If there is a small simple way to fix
;; something then do it the small and simple way.
;;
;; Your solution must include @htdf, @signature, and @template tags.
;;
(@htdf stack)
(@signature Image Image -> Image)
;; stack images, widest on bottom, first on bottom if same width
(check-expect (stack (rectangle 10 5 "solid" "blue")
(rectangle 20 9 "solid" "red"))
(above (rectangle 10 5 "solid" "blue")
(rectangle 20 9 "solid" "red")))
(check-expect (stack (rectangle 20 5 "solid" "blue")
(rectangle 20 9 "solid" "red"))
(above (rectangle 20 9 "solid" "red")
(rectangle 20 5 "solid" "blue")))
(check-expect (stack (rectangle 20 5 "solid" "blue")
(rectangle 10 9 "solid" "red"))
(above (rectangle 10 9 "solid" "red")
(rectangle 20 5 "solid" "blue")))

;(define (stack i1 i2) i1) ;stub

(@template Image)

(define (stack i1 i2)
(if (>= (image-width i1) (image-width i2))
(above i2 i1)
(above i1 i2)))

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
travissmith1 UBC
Follow You need to be logged in order to follow users or courses
Sold
97
Member since
4 year
Number of followers
61
Documents
36
Last sold
3 months ago

3.6

16 reviews

5
6
4
6
3
0
2
0
1
4

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions