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

  Program to checks to see if the value of a is valid

Checks to see if the value of a is 0; if it is, the code prints the message "no solution for a=0" and returns from the function.

  Writing class containing two instance variables

Write class named ParkingMeter containing: two instance variables named timeLeft and maxTime of type int. Value of timeLeft must be initialized to 0.

  Write pseudocode to accept candy name

Write a pseudocode for the following: A programm to accept a candy name (for exmple, "chocolate-covered blueberries'), price per pound, and number of pounds sold.

  Write and implement generic set class with attributes

Write and implement the generic Set class with attributes you find essential and with the following methods. Set class has nonduplicate elements.

  Smallest number using class-friend function and overloading

C++program which can neither be two integers or two floating point number and output smallest number using class, friend function and overloading.

  Sketch state diagram for machine using sw

Sketch the State Diagram for machine using any SW (i.e. MS Visio).: Print out your VHDL Code and Simulation waveforms for you design 3 Points: Print out your VHDL Code for your self-checking Test Bench

  Write techniques to ensure the site content is optimized

All Web pages is as small as possible without affecting the look and feel of the final product. What are some techniques to ensure the site content is optimized?

  Create a program to store assignment grades for student

The elementary school for which you are doing development work has asked you to create a program to store assignment grades for one student.

  Create a crosstab query

Create a crosstab query to show how many enrollments took place in various conventions from different companies. Also show the total number of enrollments in each convention.

  Write parameterized function to play the game

Your program cannot use file level variables or constants; your program cannot use global variables or constants. The functions that you write exchange data by means of return statements and value parameters and reference parameters

  Create program to enter number of packages bought

Create a program which asks user to enter number of packages bought . The program must then display amount of discount (if any) and total amount of purchase after the discount.

  Prepare clear button which will clear result text box

Make the compute button the Accept button. Prepare Clear button which will clear result text box and reset all text boxes, 4. controls, and internal variables used.

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