Example on substitution model

Assignment Help Programming Languages
Reference no: EM13190055

Q1)

Consider the following code;

(define (add1-iter a-list)

  (define (add1-helper curr-list result-list)

      (if (null? curr-list)

        result-list

        (add1-helper (cdr curr-list)

                     (cons (add1 (car curr-list))

                           result-list))))

  (add1-helper a-list '()))

Is this an example of head or tail recursion? Why?

Q2)

Referring to the code in Part 1, use the substitution model to illustrate what the result of calling (add1-iter '(1 2 3)) will be.  Why is the list reversed?

Reference no: EM13190055

Questions Cloud

What are both speeds : a train travels 190km in the same time a plane travels 665km.if the speed of the plane is 40km per hour less than 4 times the speed of the train, what are both speeds?
Which scale will allow her to make the tallest model : A building is 410 feet tall. For a class project, Kari is to make a scale model of the building to place in the front hall display case. The display case is 23 inches tall. Which scale will allow her to make the tallest model that will fit in the ..
How many years will it be before the consumption : Remembering that the change in the capital stock is investment less depreciation, use a calculator or a computer spreadsheet to show how the capital stock per worker will evolve over time in both countries. calculate income per worker and consumpti..
Define ph of a benzioc acid-benzoate buffer : What is the [H30+] and the pH of a benzioc acid-benzoate buffer that consists of 0.17 M C6H5COOH and 0.26 M C6H5COONa? (Ka of benzoic acid = 6.3*10^-5)
Example on substitution model : Use the substitution model to illustrate what the result of calling (add1-iter '(1 2 3)) will be.  Why is the list reversed?
What is the current organizational culture : What is the current organizational culture (look to the artifacts, norms, values, and basic assumptions)? Using either the behavioral, competing values, or deep assumptions model, briefly assess the current organizational culture of this organization..
Are your personal rights protected by the constitution : Are your personal rights protected by the Constitution? Support your arguments by sound logic and real examples.
What saving rate maximizes consumption per worker : Assume that the depreciation rate is 10 percent per year. Make a table showing steady- state capital per worker, output per worker, and consumption per worker for saving rates of 0 percent, 10 percent, 20 percent, 30 percent and 40 percent.
Mobility differ in organization with innovative career paths : How does mobility differ in organizations with innovative career paths? In the answer list three innovative career path and describe how mobility occurs in each.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write down a program to input widths of both hallways

Write down a program which prompts user to input widths of both hallways. The program then outputs length of longest pipe.

  Write program which permits user to enter first name

Write the program which permits the user to enter first names of candidates in university election and number of votes received by each candidate.

  Write program to compute integer remainder

Write program segments which accomplish each of the following:  Compute the integer part of quotient when integer a is divided by integer b.

  Program to determines and print all prime numbers

Use this function in program which determines and prints all prime numbers between 2 and 10,000. How many of these numbers do you actually have to test before being sure that you have found all primes?

  Program to output circle-s radius-diameter-circumference

Write a program to prompt the user to enter center and a point on circle. Program must then output circle's radius, diameter, circumference, and area.

  Functions of standard and statistical calculators

Write a windows application in Visual Basic to perform functions of standard and statistical calculators.

  Write program which inputs the string from user

Write a program which inputs the string from a user. Then it will take character as input and prints string onwards from that character.

  Determine seperate total of positive and negative numbers

Read set of 40 positive and negative numbers entered from keyboard and determine seperate total of positive and negative numbers. How to show modular design of above statement

  Make confirmation page using xhtml portion of script

Use XHTML portion of the script to make confirmation page to be viewed by visitor. Confirmation page must display the text of email message.

  Create program to enter expenses for the month

Create a program which asks the user to enter amount that he or she has budgeted for month. (For example: $2,000.00) A loop must then prompt the user to enter each of his or her expenses for month.

  Design logic for a program contains housekeeping

Design the logic for a program that contains housekeeping,detail loop,and end-of-job modules,and that calculates the service of charge customers owe for writing a bad check.

  Creating personnel promotion application program

The following application program will be modified to accommodate the change to the database table. The personnel promotion application program.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd