Question

;; ;; NOTE: Do not attempt to solve this problem until you have covered ;; the...

;;
;; NOTE: Do not attempt to solve this problem until you have covered
;; the How to Design Functions (HtDF) design recipe in lecture.
;;
;; Design a function called taller-image that consumes two images and produces
;; the image that has the greater height.
;;
;; Note that the template tag for a function that consumes two images is:
;;
;; (@template Image)
;;
;; and the template itself is:
;;
;; (define (taller-image i1 i2)
;; (... i1 i2))
;;

;(@htdf taller-image) ;Uncomment this line when you start the problem.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans:-

The HtDF recipe consists of the following steps:

Signature, purpose and stub.
Define examples, wrap each in check-expect.
Template and inventory.
Code the function body.
Test and debug until correct
The first step of the recipe is to identify the inherent structure of the information.

Once that is done, a data definition consists of four or five elements:

A possible structure definition (not until compound data)
A type comment that defines a new type name and describes how to form data of that type.
An interpretation that describes the correspondence between information and data.
One or more examples of the data.
A template for a 1 argument function operating on data of this type.
In the first weeks of the course we also ask you to include a list of the template rules used to form the template.

;; Time is Natural
;; interp. number of clock ticks since start of game

(define START-TIME 0)
(define OLD-TIME 1000)

#;
(define (fn-for-time t)
(... t))

;; Template rules used:
;; - atomic non-distinct: Natural
;; Countdown is Integer[0, 10]
;; interp. the number of seconds remaining to liftoff
(define C1 10) ; start
(define C2 5) ; middle
(define C3 0) ; end

#;
(define (fn-for-countdown cd)
(... cd))

;; Template rules used:
;; - atomic non-distinct: Integer[0, 10]
(define (fn-for-tlcolor ls)
(cond [Q1 A1]
[Q2 A2]
[Q3 A3]))

NOTE:- please like bro,any doubts please comment

Add a comment
Know the answer?
Add Answer to:
;; ;; NOTE: Do not attempt to solve this problem until you have covered ;; the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is what I am supposed to do: I think he wants us to do this in Java. Thank you! Fractals (a)...

    This is what I am supposed to do: I think he wants us to do this in Java. Thank you! Fractals (a) Write a function in Racket to create a Koch curve fractal. The Koch curve can be constructed by starting with a line (segment), then recursively altering each line segment as follows: divide the line segment into three segments of equal length. draw an equilateral triangle that has the middle segment from step 1 as its base and points...

  • Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development p...

    Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development practices and problem solving strategies: a) Start by writing the documentation for the function. Use docstrings shown in lecture and lab. b) Write test calls to the function in your main function for the different cases of input the function will encounter. This will help you understand the behavior of the function and later behave as tests for your function. c) Define the function d)...

  • Hi everyone, I have a C programming problem, answers are better with explanations. Background Materials: The...

    Hi everyone, I have a C programming problem, answers are better with explanations. Background Materials: The Task: The Answer: The completed C code. Below is the file charIO4C.c: #include <stdio.h> #include <ctype.h> #define QUIT_LETTER 'q' int main(void) { int c, line_length; // Each pass through the outer loop reads a line of input. while (1) { printf("\nEnter a line of text. (To quit, start the line with %c.)\n", QUIT_LETTER); c = fgetc(stdin); if (c == EOF || c == QUIT_LETTER)...

  • Please note that all the steps are meant to help solve the problem. Question A1: We have yet to discover what happens wh...

    Please note that all the steps are meant to help solve the problem. Question A1: We have yet to discover what happens when the matrix that defines our system has a repeated real eigenvalue. Let's start with the case of a system defined by a diagonal matrix, which has the twice repeated real eigenvalue A 3. Follow the steps below to analyze the shape of the trajectories and draw the phase plane portrait: 1. Write down the explicit solution to...

  • Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be...

    Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book tit le, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an...

  • Don't attempt if you can't attempt fully, i will dislike and negative comments would be given...

    Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...

  • write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle...

    write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle Objective: Write MATLAB scripts to solve differential equations. Implementation: MatLab is an ideal environment for solving differential equations. Differential equations are a vital tool used by engineers to model, study and make predictions about the behavior of complex systems. It not only allows you to solve complex equations and systems of equations it also allows you to easily present the solutions in graphical form....

  • Game Description: Most of you have played a very interesting game “Snake” on your old Nokia...

    Game Description: Most of you have played a very interesting game “Snake” on your old Nokia phones (Black & White). Now it is your time to create it with more interesting colors and features. When the game is started a snake is controlled by up, down, left and right keys to eat food which appears on random locations. By eating food snake’s length increases one unit and player’s score increases by 5 points. Food disappears after 15 seconds and appears...

  • Can you please write the two C++ modules below is a step by step instuctions to...

    Can you please write the two C++ modules below is a step by step instuctions to follow that will make it very easy thanks. Create a module called pqueue.cpp that implements priority queues, with a header file calledpqueue.hthat describes what pqueue.cpp exports. The interface includes the following, and nothing else. Types ItemType and PriorityType are discussed below under the refinement plan. A type, PriorityQueue. Creating a PriorityQueue object with line PriorityQueue q; makes q be an initially empty priority queue....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT