|
|
|
|
|
by the_af
4161 days ago
|
|
> But realistically, an unused parameter should probably be removed. Think about the function if-then-else, which you may be familiar with from your favorite language :) if-then-else true branch1 branch2 = branch1
if-then-else false branch1 branch2 = branch2
Obviously you don't want both branches evaluated in any given invocation, and obviously you cannot remove the unused parameter. Note that the purpose is not to "save computation", since for example branch1 may be undefined if cond is false!When using a language with support for lazy evaluation, you encounter this kind of functions all the time. |
|