Hullaballoonatic
12/04/2019, 5:07 PMfold
and reduce
have foldRight
, reduceRight
, I would like windowedRight
and chunkedRight
. My current use case is also maybe the best example:
val Int.digitBlocks get() = toString().chunkedRight(3).map(String::toInt) // 1_234_567 -> [[567], [234], [1]]
I noticed CharSequence
also has a version of windowed
that accepts a transform operation, and I would like that for Iterable
as well.
In general why don't most Iterable operations also have a version with a transform operation tacked on? I don't think that hurts readability, and only partially conflicts in places where the operation already receives a lambda, like partition
Zach Klippenstein (he/him) [MOD]
12/04/2019, 5:14 PMasReversed()
first?Hullaballoonatic
12/04/2019, 5:15 PM[[765], [432], [1]]
in my example; the contents of each chunk are also reversedHullaballoonatic
12/04/2019, 5:17 PMasReversed().chunked(3).map { it.asReversed().toInt() }
would workZach Klippenstein (he/him) [MOD]
12/04/2019, 5:23 PM