Hullaballoonatic
06/16/2019, 6:48 PMNumber
changed from Abstract Class to Interface, given it is purely composed of abstract methods.Hullaballoonatic
06/16/2019, 6:56 PMNumber
in interfaceskarelpeeters
06/16/2019, 7:58 PMNumber
, ever. It's a near useless class, none of the functions it requires are guarateed to do something meaningful on all numbers.Hullaballoonatic
06/16/2019, 8:00 PMkarelpeeters
06/16/2019, 8:02 PMkarelpeeters
06/16/2019, 8:04 PMHullaballoonatic
06/16/2019, 8:04 PMHullaballoonatic
06/16/2019, 8:04 PMHullaballoonatic
06/16/2019, 8:05 PMkarelpeeters
06/16/2019, 8:06 PMHullaballoonatic
06/17/2019, 12:52 AMkarelpeeters
06/17/2019, 11:50 AMZach Klippenstein (he/him) [MOD]
06/18/2019, 3:06 AMmiha-x64
06/18/2019, 8:36 AMBoolean
to be a valid Number
.karelpeeters
06/18/2019, 8:48 AMmiha-x64
06/18/2019, 8:54 AMHullaballoonatic
06/19/2019, 5:36 PMprint(bool * bar)
if the bool is false you get 0 otherwise you get the bar
thus working kind of like ?
karelpeeters
06/19/2019, 5:52 PMkarelpeeters
06/19/2019, 5:52 PMbar
isn't a boolean? Yikes simple smilesksk
06/21/2019, 1:03 PMsksk
06/21/2019, 1:03 PMkarelpeeters
06/21/2019, 1:03 PMsksk
06/21/2019, 1:03 PMkarelpeeters
06/21/2019, 1:04 PMsksk
06/21/2019, 1:05 PMHullaballoonatic
06/27/2019, 6:59 PMNumber
would be best if implemented as so:
interface Number<N: Number<N>> : Comparable<Number<*>> {
operator fun plus(other: N): N
operator fun minus(other: N): N
operator fun unaryMinus(): N
operator fun unaryPlus(): N = this
operator fun times(other: N): N
operator fun div(other: N): N
}
I'd personally also toss in
infix fun pow(other: N): N
infix fun root(other: N): N
val inverse: N
But that's probably asking too much...karelpeeters
06/27/2019, 7:33 PM-
doesn't work (natural numbers) root isn't defined (integers), division isn't defined (quaternions), ... You really do need separate interfaces.Hullaballoonatic
06/27/2019, 7:34 PMkarelpeeters
06/27/2019, 7:35 PMHullaballoonatic
06/27/2019, 7:36 PMmiha-x64
06/28/2019, 7:55 AMCmp
and PartialCmp
, Ord
and PartialOrd
, to handle NaNs. Same may be applicable for computing roots, doing division, etc