Big Chemical Encyclopedia

Chemical substances, components, reactions, process design ...

Articles Figures Tables About

Tail recursion

A less orthodox line of attack, as yet not explored to its full potential, applies from the beginning the recursion method to the solid-plus-impurity system. The direct use of memory function methods to the perturbed solid is no more difficult than for the perfect solid, with the advantage of overcoming the traditional separation of the actual Hamiltonian into a perfect part and a perturbed part. In fact, such a separation, to make any practical sense, requires that the perturbed part be localized in real space, a restriction hardly met when treating impurities with a coulombic tail. [Pg.169]

With the help of append the predicate permutation is easy to understand. The first clause says that the permutation of an empty list is an empty list. This seems to be trivial but it is essential since the second mle is recursive and therefore depends on this rule to terminate. The second mle says that to compute a permutation one has first to split the given list (X) into two sublists (Y and [ HI Z ]). The head of the second list (H) becomes the first element of the result ( [ H T ] ), but note that T is not yet instantiated. Then the first list (Y) and the tail-end of the second list (Z) are concatenated, forming list P. List P is permuted and this permuted list (T) forms the tail-end of the result ( [ H T ] ). [Pg.229]

A divide-and-conquer algorithm for a binary predicate r over parameters X and Y works as follows. Let X be the induction parameter. IfX is minimal, then Y is (usually) easily found by directly solving the problem. Otherwise, that is if X is non-minimal, decompose X into a vector HX of heads of X and a vector TX of tails of X, the tails being of the same type as X, as well as smaller than X according to some well-founded relation. The tails TX recursively yield tails TY of Y. The heads HX are processed into a vector HY of heads of Y. Finally, Y is composed from its heads HY and tails TY. [Pg.104]

An instantiation of the Decompose predicate-variable deterministically decomposes, in the non-minimal case, the induction parameter, say X, into a vector HX of heads and a vector TX of tails, the tails TXj being smaller than X according to some well-founded relation. These tails are meant for the recursive computation of the tails TYj of the other parameter, say Y. Step 3 yields LA ir) by instantiating the Decompose predicate-variable by means of the Database Method, which here relies on a database of type-specific decomposition formulas. [Pg.154]

An instantiation of a Process/ predicate-variable transforms the heads HX of the induction parameter X into a vector HY of heads of the other parameter Y. An instantiation of a Composepredicate-variable computes the other parameter Y from its heads HY (obtained by processing the HX) and tails TY (obtained by recursion on the TX). Step 6 does this simultaneously, and hence actually looks for an instantiation of a ProcCompk predicate-variable that computes the other parameter Y from the heads HX and tails TY. Step 6 yields LA(fr) by first invoking the MSG Method (see Chapter 10) and assessing its results via some heuristics if these results are not satisfying, then a so-called Synthesis Method (see Section 14.2.4) is invoked. [Pg.156]

Values are returned by a function call with the statement return explist where explist is a comma separated list of Lua objects. As with break, the return statement must be the last statement of a block of code. In some cases this necessitates the do return explist end Lua construct to return from within a block. Lua implements function recursion and when the recursive function call is of the form return function call() Lua implements proper tail calls where there is no limit on the number of nested tail calls that a program can execute. [Pg.996]


See other pages where Tail recursion is mentioned: [Pg.262]    [Pg.21]    [Pg.27]    [Pg.62]    [Pg.109]    [Pg.262]    [Pg.21]    [Pg.27]    [Pg.62]    [Pg.109]    [Pg.175]    [Pg.126]    [Pg.175]    [Pg.224]    [Pg.3537]    [Pg.105]    [Pg.154]    [Pg.171]    [Pg.197]    [Pg.146]   
See also in sourсe #XX -- [ Pg.109 ]




SEARCH



Recursion

Recursive

© 2024 chempedia.info