slovo | definícia |
a lift (encz) | a lift,dobrý pocit Zdeněk Brož |
| podobné slovo | definícia |
get a lift (encz) | get a lift,svézt se v: Zdeněk Brož |
get a lift/ride (encz) | get a lift/ride,svézt se |
give a lift/ride to (encz) | give a lift/ride to,svézt |
give me a lift (encz) | give me a lift, |
fully lazy lambda lifting (foldoc) | fully lazy lambda lifting
John Hughes's optimisation of lambda lifting to give {full
laziness}. Maximal free expressions are shared to minimise
the amount of recalculation. Each inner sub-expression is
replaced by a function of its maximal free expressions
(expressions not containing any bound variable) applied to
those expressions. E.g.
f = \ x . (\ y . (+) (sqrt x) y)
((+) (sqrt x)) is a maximal free expression in
(\ y . (+) (sqrt x) y) so this inner abstraction is replaced
with
(\ g . \ y . g y) ((+) (sqrt x))
Now, if a partial application of f is shared, the result of
evaluating (sqrt x) will also be shared rather than
re-evaluated on each application of f. As Chin notes, the
same benefit could be achieved without introducing the new
higher-order function, g, if we just extracted out (sqrt x).
This is similar to the code motion optimisation in
procedural languages where constant expressions are moved
outside a loop or procedure.
(1994-12-01)
|
lambda lifting (foldoc) | lambda lifting
A program transformation to remove free variables. An
expression containing a free variable is replaced by a
function applied to that variable. E.g.
f x = g 3 where g y = y + x
x is a free variable of g so it is added as an extra argument:
f x = g 3 x where g y x = y + x
Functions like this with no free variables are known as
supercombinators and are traditionally given upper-case names
beginning with "$". This transformation tends to produce many
supercombinators of the form f x = g x which can be eliminated
by eta reduction and substitution. Changing the order of
the parameters may also allow more optimisations. References
to global (top-level) constants and functions are not
transformed to function parameters though they are technically
free variables.
A closely related technique is closure conversion. See also
Full laziness.
|
|