Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Created September 16, 2022 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/7755fa494f3f26f7483cdb4d5271b89c to your computer and use it in GitHub Desktop.
Save s1monw1/7755fa494f3f26f7483cdb4d5271b89c to your computer and use it in GitHub Desktop.
// return receiver T
fun T.also(block: (T) -> Unit): T //T exposed as it
fun T.apply(block: T.() -> Unit): T //T exposed as this
// return arbitrary value R
fun <T, R> T.let(block: (T) -> R): R //T exposed as it
fun <T, R> T.run(block: T.() -> R): R //T exposed as this
// return arbitrary value R, not an extension function
fun <T, R> with(receiver: T, block: T.() -> R): R //T exposed as this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment