What is the tail?

In computer programming, the tail call a specific situation within the program source code in which function, subroutines or procedure returns the expected value by calling another function instead of simply passing the variable to hold the return value. The name itself indicates that the function called to calculate the value to be returned is at the end or tail of the function that calls it to give the return value. Some programmers are an interesting tail call, because with certain optimizations or behavior of the compiler, no additional space space is used to store the main function; Instead, the tail function is used to generate the return value directly back to the call point where the original function was induced. The use of the tail call is particularly useful in situations where recursion is used because the amount of magazine space used to store the caller in cases where recursive calls nesting very deeply could run quicklyt and stop the progrum design. Although the use of tail calls can help increase the speed, use of memory and efficiency in the program, it can also lead to situations in which the source code is restructured to use calls in a way that makes tuning and monitoring, especially with recursion cases.

The existence of the tail call is largely due to how a call magazine works in most computer programs and system architectures. A stack that is like a pile of boards is a first -class data data structure. When a function, subroutine or procedure is called, the address from which the call is made in the tank is called the tank frame. This means that the program calling a function A, which then calls function B, will have two magazines, one for function B and the other below it for function A. After completing function B, its tank frame jumps from the top of the magazine and performingwill finally return the program check to the point from which the first function was originally called.

6 In the above example, if the function calls the function B directly with the return command, a tail call has been created. Within the call magazine, instead of having a magazine for both functions A and B, Function B receives a return address from function A and Function A's Stack Frame will be popped up and destroyed, which means that the function B transmits its return value directly back to a place called the function without having to pass on the function. Help, as well as help, as well as help, as well as helps, as well as help, as well as help, as well as help, as will help, as well as help, as will help as it increases.

Properties of the tail call from themThey can be very much -aric option for recursive functions. A recursive function is a function that is repeatedly called to calculate the value of how it can be when the list of data structures can be brows. No additional magazine frames are created for nested functional calls, so a very deep recursion level cannot be safely performed without immediate endangering the overflow of the magazine and the possible end of the program.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?