100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary CPSC 110 PSET 2 SOLUTIONS CA$30.48   Add to cart

Summary

Summary CPSC 110 PSET 2 SOLUTIONS

 295 views  3 purchases

L CPSC 110 PSET 2 SOLUTIONS

Preview 1 out of 4  pages

  • July 11, 2021
  • 4
  • 2020/2021
  • Summary
All documents for this subject (10)
avatar-seller
travissmith1
;; 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)))

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller travissmith1. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for CA$30.48. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75632 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
CA$30.48  3x  sold
  • (0)
  Add to cart