Post

Higher-order functions take other functions as arguments. The fun part: you must not inline the call unless the target is constant - otherwise you break semantics (and your VM). #kotlin

24 reposts409 likes

A first order function takes parameters, a second order function takes a function as a parameter, a third order function takes a function that takes a function as a parameter, and so on

I think it's useless to try and evaluate the order of a function where the parameter doesn't have a strict static type, because whatever order of function you have, you can always make it have an order one higher. So basically,

In your example, f is simply a higher-order function. That's it. In a typed programming language it returns a function of the same order as its argument, and the order of the function itself is the order of the argument plus one.

My all time favourite foot-gun lol I wish my IDE had an extension that tracked the frequency and types of exceptions so that I could chart it from time to time. That'd be a lot of fun to track over time.