A definition can be introduced to denote an identified sub-expression, and the sub-expression will be replaced by a call to the new definition.
addThree = \ a b c -> a + b + c
|
addThree = \ a b c -> f a b c
where
f a b c = a + b + c
|
General comment:
Left to right comment:
The definition is introduced as a local definition, and it can be lifted afterwards. Formal parameters
will be added to the new definition iff the free variables in the identified sub-expression won't be accessable by to new definition.
| Right to left comment: |
Left to right conditions:
The name for the new definition should not cause name capture/clash.
| Right to left conditions: |