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.
Think about the function if-then-else, which you may be familiar with from your favorite language :)
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.