hudsonb
11/03/2018, 12:19 PM->
in the else
of the `when`:
internal fun hue(a: Double, b: Double): (Double) -> Double {
val d = b - a
return when {
d.isTruthy() -> linear(a, if (d > 180 || d < -180) d - 360.0 * Math.round(d / 360.0) else d)
else -> { _ -> if(a.isNaN()) b else a } // Redundant lambda arrow
}
}
Removing it changes the type from (Double) -> Double
to Double
. Is there a better approach?karelpeeters
11/03/2018, 12:29 PMEgor Trutenko
11/03/2018, 12:39 PMelse
branch, obviously. But I think you may try and wrap it into {{ ... }}
. I tend to agree with @karelpeeters that this is idea warning bughudsonb
11/03/2018, 12:52 PMwhen
produces the correct type.
Seems like there's no way to not have the IDE warn me about something: _: Double
gives the same warning, using a name instead of _
warns that the parameter is never used,karelpeeters
11/03/2018, 12:55 PMpdvrieze
11/03/2018, 2:05 PMAlexey Belkov [JB]
11/07/2018, 8:42 AM