anstaendig
09/13/2017, 12:11 PMrun()
. I tend to use it in cases where I would combine let()
and `with()`…elect
09/21/2017, 11:39 AMpathOf(String/URI)
?holgerbrandl
09/29/2017, 8:20 AMlog
at least provide e
as default for the base? Because if so users could keep using log
as natural logarithm. LIke in python https://docs.python.org/2/library/math.html#math.log or R http://astrostatistics.psu.edu/su07/R/html/base/html/Log.htmldmitry.petrov
10/09/2017, 5:24 PMelect
10/09/2017, 5:45 PMx += y
with plusAssign
and x + y
with plus
? It's really a pity to give up on that because of ambiguitykarelpeeters
10/12/2017, 6:58 AMkarelpeeters
10/12/2017, 9:21 AMuli
10/12/2017, 11:28 AMuse {}
decided to ignore them?karelpeeters
10/15/2017, 7:18 PMMarc Knaup
10/21/2017, 3:52 PMval Class<*>.boxed
get() =
if (isPrimitive)
when (this) {
Boolean::class.java -> java.lang.Boolean::class.java
Char::class.java -> java.lang.Character::class.java
Byte::class.java -> java.lang.Byte::class.java
Short::class.java -> java.lang.Short::class.java
Int::class.java -> java.lang.Integer::class.java
Long::class.java -> java.lang.Long::class.java
Float::class.java -> java.lang.Float::class.java
Double::class.java -> java.lang.Double::class.java
Void.TYPE -> java.lang.Void::class.java
else -> error("Unexpected primitive class: $this")
}
else
this
fun Class<*>.isAssignableOrBoxableTo(otherClass: Class<*>) =
otherClass.isAssignableOrBoxableFrom(this)
fun Class<*>.isAssignableOrBoxableFrom(otherClass: Class<*>) =
boxed.isAssignableFrom(otherClass.boxed)
🤔
Would that be useful for stdlib?jw
11/01/2017, 9:43 PMholgerbrandl
11/10/2017, 7:05 AMDmitry Kandalov
11/23/2017, 4:05 PMtrimStart()
, it shouldn't say " and trailing".
https://github.com/JetBrains/kotlin/blob/1.1.60_173/libraries/stdlib/src/kotlin/text/Strings.kt#L106
https://github.com/JetBrains/kotlin/blob/1.1.60_173/libraries/stdlib/src/kotlin/text/Strings.kt#L111holgerbrandl
11/24/2017, 7:27 AMraulraja
12/03/2017, 12:33 AMA?
in those types of operations that throw exceptions because the only possible error in that context is being out of range.madorb
12/04/2017, 9:48 PMelect
12/05/2017, 11:31 AM0 until x
is [0, x)
, but x downTo 0
is [x, 0]
karelpeeters
12/05/2017, 11:55 AMx to y
that returns a sequence that goes into whatever direction is required, for example: 0 to 5
is [0,1,3,4]
and 0 to -5
is [0,-1,-2,-3,-4]
.kingsley
12/05/2017, 3:43 PMinfix fun Int.through(end: Int): IntProgression {
return if (end > this) this..end else this downTo end
}
fun main(args: Array<String>) {
(0 through 5).forEach(::println)
(4 through -3).forEach(::println)
}
damian
12/08/2017, 6:14 PMnatpryce
12/10/2017, 2:57 PMlouiscad
12/18/2017, 10:35 AMByte
and Short
are marked as experimental in the stdlib?jw
01/12/2018, 4:42 AMvmichalak
01/12/2018, 6:47 PMraulraja
01/12/2018, 10:53 PMkarelpeeters
01/13/2018, 12:11 AMgroostav
01/15/2018, 4:07 AMfun java.io.Reader.asCharSequence(decoding: Charset = Charsets.UTF_8)): Sequence<Char>
--or other wrappers on <http://java.io|java.io>
classes in the std-lib?raulraja
01/24/2018, 11:07 PMsxtanna
02/03/2018, 10:22 PMtoMap()
function available as an extension on a collection of Map.Entry<K, V>
?hho
02/05/2018, 9:43 AM"your string".substring(startIndex).matches(regexp)
hho
02/05/2018, 9:43 AM"your string".substring(startIndex).matches(regexp)
uhe
02/05/2018, 9:52 AMsubstring
I automatically see StringIndexOutOfBoundsException
😄