Created
July 12, 2024 04:04
-
-
Save andiogenes/a0c615088b774702acf4b8f562fbe2df to your computer and use it in GitHub Desktop.
Recursive inline in Scala 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline def unroll(inline times: Int)(inline action: Int => Unit): Unit = | |
if (times > 0) | |
action(times) | |
unroll(times - 1)(action) | |
unroll(4)(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment