Hacker News new | past | comments | ask | show | jobs | submit login

"Higher order" functions are about whether a function takes code as a tuneable parameter, rather than "just" (user) data.

A regular function call is first-order:

    foo(bar: Int): Int
While is usually a magical special case, but conceptually it's just a higher-order function that takes two functions:

    while(keepGoing: () => Boolean, action: () => Unit): Unit
Or, if you want to be pedantic:

    while[M: Monad](keepGoing: Monad[Boolean], action: Monad[Unit]): Monad[Unit]



Your higher-order while construct certainly mimics the normal first-order while one. But that's not really the point.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: