Is this an example of head or tail recursion

Assignment Help Programming Languages
Reference no: EM13315323

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: EM13315323

Questions Cloud

Recombination era-electromagnetic-weak force combined : Galaxies are moving apart, with a velocity proportional to the distance between them. The "Recombination Era" is when the electromagnetic and weak force combined into a single force. Time appears symmetric under all forces except the strong force.
Find its translational kinetic energy : A solid bowling ball with a radius of 10.9 cm and a mass of 7.1 kg rolls along a bowling alley at a linear speed of 3.0 m/s. What is its translational kinetic energy
Determine the speed of the hoop : A hoop and a disk, both of 0.86- m radius and 5.0- kg mass, are released from the top of an inclined plane 3.5 m high and 9.0 m long. What is the speed of the hoop
Find the minimum torque that must be applied to second hand : A clock has a second hand whose tip rubs against the inside of the glass cover. what is the minimum torque that must be applied to the second hand
Is this an example of head or tail recursion : 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 ?
The weak force is stronger than gravity : Astronomers coined the term “Big Bang” in an effort to popularize the theory. Dark matter is a force that counters gravity and accounts for the increasing rate of expansion of the universe. Astronomers generally concede that dark matter mostly consis..
Determine how much force is required : An iron disk has a radius of 0.445 m and a mass of 367 kg. The disk is mounted on its axis so that it is free to spin. If the torque is applied at the edge of the disk, how much force is required
Compute the angular acceleration of the wheel : A torque of 14Nm is applied to a heavy wheel whose moment of inertia is 34 kgm2. What is the angular acceleration of the wheel
Recruited into terrorist organizations : Are there any common sociological and/or psychological characteristics of the people who are recruited into terrorist organizations? What are factors that may contribute to a person’s decision to join a terrorist group

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