Programming Language Pragmatics, Fourth Edition
4th Edition
ISBN: 9780124104099
Author: Michael L. Scott
Publisher: Elsevier Science
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3, Problem 2E
Explanation of Solution
Justification:
- The recursion feature is absent in FORTRAN 77. So there can be more than one live instance of local variable of the particular subroutine.
- Algol and its successor require a stack to store multiple copies.
- The following program statements would not work correctly with statically allocated local variables.
//Defining the function sum and passing the arguments.
function sum(f, small, large)
{
//Making condition for if.
if small = large
//Returning the small value.
return f(small)
//Else statement
else
//Returning computed small value.
return f(small) + sum(f, small + 1, large)
}
Explanation:
- Now the sum() functions needs to remember the value of small while recursive call.
- In Section 6.6.1, it is potential to write a tail recursive version of sum that doesn’t need to remember anything while recursive call, but only if one is willing to change the calling signature of the function or to exploit the associativity of addition...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Programming Language Pragmatics, Fourth Edition
Ch. 3.2 - Prob. 1CYUCh. 3.2 - Prob. 2CYUCh. 3.2 - Prob. 3CYUCh. 3.2 - Prob. 4CYUCh. 3.2 - Prob. 5CYUCh. 3.2 - Prob. 6CYUCh. 3.2 - Prob. 7CYUCh. 3.2 - Prob. 8CYUCh. 3.2 - Prob. 9CYUCh. 3.2 - Prob. 10CYU
Ch. 3.2 - Prob. 11CYUCh. 3.3 - Prob. 12CYUCh. 3.3 - Prob. 13CYUCh. 3.3 - Prob. 14CYUCh. 3.3 - Prob. 15CYUCh. 3.3 - Prob. 16CYUCh. 3.3 - Prob. 17CYUCh. 3.3 - Prob. 18CYUCh. 3.3 - Prob. 19CYUCh. 3.3 - Prob. 20CYUCh. 3.5 - Prob. 21CYUCh. 3.5 - Prob. 22CYUCh. 3.5 - Prob. 23CYUCh. 3.5 - Prob. 24CYUCh. 3.5 - Prob. 25CYUCh. 3.5 - Prob. 26CYUCh. 3.5 - Prob. 27CYUCh. 3.5 - Prob. 28CYUCh. 3.5 - Prob. 29CYUCh. 3.5 - Prob. 30CYUCh. 3.5 - Prob. 31CYUCh. 3.5 - Prob. 32CYUCh. 3.5 - Prob. 33CYUCh. 3.7 - Prob. 34CYUCh. 3.7 - Prob. 35CYUCh. 3.7 - Prob. 36CYUCh. 3.7 - Prob. 37CYUCh. 3.7 - Prob. 38CYUCh. 3.7 - Prob. 39CYUCh. 3.7 - Prob. 40CYUCh. 3.7 - Prob. 41CYUCh. 3.7 - Prob. 42CYUCh. 3 - Prob. 1ECh. 3 - Prob. 2ECh. 3 - Prob. 3ECh. 3 - Prob. 4ECh. 3 - Prob. 5ECh. 3 - Prob. 6ECh. 3 - Prob. 7ECh. 3 - Prob. 9ECh. 3 - Prob. 10ECh. 3 - Prob. 11ECh. 3 - Prob. 12ECh. 3 - Prob. 13ECh. 3 - Prob. 14ECh. 3 - Prob. 15ECh. 3 - Prob. 16ECh. 3 - Prob. 17ECh. 3 - Prob. 18ECh. 3 - Prob. 19ECh. 3 - Prob. 20ECh. 3 - Prob. 21ECh. 3 - Prob. 22ECh. 3 - Prob. 23E
Knowledge Booster
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education