|
|
Am 03.10.2016 um 14:06 schrieb John Greenwood:
> The first parameter of the select function acts as a logic switch
No, it absolutely positively does _not_.
The select function acts as a _threshold_ switch, forming an
indispensible basic building block for piecewise-defined functions.
> but does not
> respond correctly to a boolean variable, thus
>
> #declare Change = true;
> #declare Function = function( F){select(Change,F,-F)}
>
> gives the same result for Change = false
>
> #declare Function = function( F){select(-Change,F,-F)}
>
> works.
>
> This is not consistant, but I suppose we are stuck with it.
With the `select()` function implemented as a threshold switch, there
would be _no way whatsoever_ to have it also behave consistently as a
boolean switch. Remember that wherever a boolean is expected, _any_
non-zero value is interpreted as `true`, not just positive values.
So in a way it is rather fortunate that `select()` behaviour does _not_
happen to match the behaviour expected of a boolean switch for both
`true` and `false` input values, as that might lead people to
erroneously expect boolean switch behaviour for other input values as
well where it absolutely positively cannot be supported.
Post a reply to this message
|
|