Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinhigher-order function compositionSingle-choice MCQ

What is printed, and why does the order differ from `compose`?

infix fun <A, B, C> ((A) -> B).andThen(g: (B) -> C): (A) -> C = { a -> g(this(a)) } val half: (Int) -> Int = { it / 2 } val square: (Int) -> Int = { it * it } println((half andThen square)(10))