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 a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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