Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using DrRacket programming language: Lets build some lego buildings out of lego bricks. Here are data definitions for lego bricks and lego buildings: (define-struct lego

Using DrRacket programming language:

Lets build some lego buildings out of lego bricks. Here are data definitions for lego bricks and lego buildings:

(define-struct lego (label color width))

;; A Lego is a structure:

;; (make-lego Number Symbol Number)

;; interpretation: (make-lego l c w) is the lego brick

;; with label l, color c, and width w (in pixels).

(define-struct bigger (lego left right))

;; A LegoBldg (lego building) is one of:

;; - Lego

;; - (make-bigger Lego LegoBldg LegoBldg)

;; interpretation: (make-bigger lg lft rgt) makes a bigger

;; lego building by putting a lego brick lg on top of two lego

;; buildings lft (left) and rgt (right).

Problem 1 Design a function, count-bricks, that takes a lego building and produces the total number of lego bricks in that building.

Problem 2 Each lego brick is 10 pixels tall. Design a function, how-high, that takes a lego building and produces the total height of the lego building (in pixels).

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

More Books

Students also viewed these Databases questions

Question

Given the network in fig 11.42, find Vo (max). 0.5 4mH 12 cos ot V

Answered: 1 week ago

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago