https://kotlinlang.org logo
p

programmerr47

07/14/2017, 6:04 AM
Hey all. Recently I've created stackoverflow question and then question in kotlin forum about BigDecimal progressions. Here is a link to it: https://discuss.kotlinlang.org/t/kotlin-bigdecimal-progression/3654 In short: kotlin has a progressions. In fact it has Char, Int and Long progressions. One of the sugar things that language supports to them is '..' operations. So you able to write something like (0..10) or (0L..10L) or ('a'..'z'). My question is can it be done for BigDecimals? So I wrote simple implementation of it (based on IntProgression), you can find it in the above link. But main problem is, when you implementing your own progression you not able to write (bigDecimal1..bigDecimal2) since there is no support '..' for BigDecimals. So my question is, can we really implement ranges and progressions for BigDecimals? And if yes, then my proposal is to do it. Thank you. Will appreciate to see feedback.
g

gildor

07/14/2017, 6:12 AM
If you have own Progression for BigDecimal (and you know about all possible problems with it) why you just don’t want to implement own
rangeTo
operator? https://kotlinlang.org/docs/reference/ranges.html#rangeto
p

programmerr47

07/14/2017, 6:16 AM
You right, my fault. Sorry
g

gildor

07/14/2017, 6:18 AM
No problem, I just would to figure out with your case
p

programmerr47

07/14/2017, 6:23 AM
As it appeared there was no problem. I can write '..' operation for two BigDecimals. But somehow I was not able to do that few weeks ago.
g

gildor

07/14/2017, 6:23 AM
👍
p

programmerr47

07/14/2017, 6:24 AM
Still I'm wondering we Kotlin do not support progressions for BigDecimals. I thought that ability to go over decimal numbers is interesting. But it is more rhetorical question. Anyway, thank you for your help
6 Views