Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Strength reduction
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Induction variable (orphan) == [[Induction variable]] or recursive strength reduction replaces a function of some systematically changing variable with a simpler calculation using previous values of the function. In a [[procedural programming language]] this would apply to an expression involving a loop variable and in a [[Declarative programming language|declarative language]] it would apply to the argument of a [[recursion (computer science)|recursive function]].<ref>{{foldoc|Strength+reduction}}</ref> For example, <syntaxhighlight lang=haskell> f x = ... (3 ** x) ... (f (x + 1)) ... </syntaxhighlight> becomes <syntaxhighlight lang=haskell> f x = f' x 1 where f' x z = ... z ... (f' (x + 1) (3 * z)) ... </syntaxhighlight> Here modified recursive function {{prime|f}} takes a second parameter z = 3 ** x, allowing the expensive computation (3 ** x) to be replaced by the cheaper (3 * z).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)