mutexkid
03/27/2017, 5:56 PMmutexkid
03/27/2017, 5:57 PMmutexkid
03/27/2017, 5:57 PMra1nmak3r
03/27/2017, 6:04 PMmutexkid
03/27/2017, 6:06 PMsreich
03/27/2017, 6:13 PMra1nmak3r
03/27/2017, 6:27 PMra1nmak3r
03/27/2017, 6:28 PMredrield
03/27/2017, 6:33 PMredrield
03/27/2017, 6:33 PMsreich
03/27/2017, 6:38 PMrudolf.hladik
03/28/2017, 7:54 AMelect
03/28/2017, 9:45 AMinline infix fun run(block: MatrixStack.() -> Any): MatrixStack {
block()
return this
}
And then I have a return
inside block()
what happens?elect
03/28/2017, 9:49 AMfun getSphereOrbitPos(modelMatrix: MatrixStack, ..): Vec3 {
modelMatrix run {
..
return (top() * Vec4(0.0f, 0.0f, 0.0f, 1.0f)).toVec3() // possible?
}
}
I'd like to return the intermediate result
which is only available inside the run{ }
elect
03/28/2017, 9:50 AMvar result: Vec3
I get error inside `run`:
Expected a value of type Any??
elect
03/28/2017, 10:00 AMs.luhmirins
03/28/2017, 10:05 AMreturn@run
?s.luhmirins
03/28/2017, 10:06 AMs.luhmirins
03/28/2017, 10:10 AMelect
03/28/2017, 10:13 AMreturn@getSphereOrbitPos
, but will be the rest of the HO function be executed?s.luhmirins
03/28/2017, 10:13 AMizorin
03/28/2017, 11:56 AMmiha-x64
03/28/2017, 11:57 AMtoList()
etcizorin
03/28/2017, 11:58 AMmapOf
requires vararg
of Pair
and just toList
doesn’t workmiha-x64
03/28/2017, 12:00 PMmutableMapOf("a" to “b”).toMap()
izorin
03/28/2017, 12:01 PMmiha-x64
03/28/2017, 12:05 PMuser
03/29/2017, 12:09 AManotherResult
is the more elegant one because it avoids the mutableList
property of resultArray
. Also, you could more easily chain another operation after the filter
(e.g. a .map{ it.toUpperCase() }
)poohbar
03/29/2017, 2:04 AMpoohbar
03/29/2017, 2:05 AMclass MyClass() {
init {
foo()
}
val obj? = MyObj(10)
fun foo() {
// obj is null here
}
}