# Function Reference

Published articles for Function Reference.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Lambdas and Function References

DevFeed: [Lambdas and Function References](<https://devfeed.tech/articles/lambdas-and-function-references-25059.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-lambdas/>)

Author: author@typealias.com (Dave Leeds)

Published: 2022-02-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [closure](<https://devfeed.tech/tags/closure.md>), [code](<https://devfeed.tech/tags/code.md>), [function](<https://devfeed.tech/tags/function.md>), [function-reference](<https://devfeed.tech/tags/function-reference.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

A tutorial introduction to Kotlin lambdas, function types, and function references, using a barber-shop pricing example involving coupons and tax.

### Source excerpt

As we've seen, functions are a basic building block of Kotlin code. Throughout this book, we've written a lot of them, all using the fun keyword. Kotlin also gives us another way to write functions--lambdas! To help us learn about function types, function references, and lambdas, we'll need to pay a visit to Bert's Snips & Clips. Bert's Snips & Clips Bert's Snips & Clips is the barber shop to go to for a clean haircut and a nice smooth shave.

## Kotlin Functional Interfaces: Function reference and SAM conversion

DevFeed: [Kotlin Functional Interfaces: Function reference and SAM conversion](<https://devfeed.tech/articles/kotlin-functional-interfaces-function-reference-and-sam-conversion-38640.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_10_17_kotlin_functional_interfaces_function_references_and_sam_conversion/>)

Published: 2020-10-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [callback](<https://devfeed.tech/topics/callback.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [function](<https://devfeed.tech/topics/function.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [bytecode](<https://devfeed.tech/tags/bytecode.md>), [callback](<https://devfeed.tech/tags/callback.md>), [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [function](<https://devfeed.tech/tags/function.md>), [function-reference](<https://devfeed.tech/tags/function-reference.md>), [functional](<https://devfeed.tech/tags/functional.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [interop](<https://devfeed.tech/tags/interop.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>)

### AI overview

This tutorial examines Kotlin functional interfaces, function references, and SAM conversion in a callback scenario. It explains that Kotlin 1.4 supports SAM conversion for functional interfaces, allowing callback objects to be created from function references. Although separate callback objects are created for different method calls, they delegate to the same function reference and the program behaves correctly; explicit callback instances can avoid repeated allocations.

### Source excerpt

Introduction About two years ago I made a post about a tricky case in Kotlin-Java interop related to the usage of function references and SAM conversion. One of the points there was that in Kotlin, if interface is declared instead of a function, one has to explicitly create an object, therefore no caveats as with interop: val callback = object : ThirdParty.Callback { override fun onValueChanged(value: Int) { this@App.onValueChanged(value) } } With Kotlin 1.4 there is now a "Functional interface" which supports SAM conversion. And I've been asked on how it works in a similar situation. Let's find out.

## let() (scope function)

DevFeed: [let() (scope function)](<https://devfeed.tech/articles/let-scope-function-25019.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/let/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-04T19:54:18Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Library](<https://devfeed.tech/topics/library.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function-reference](<https://devfeed.tech/tags/function-reference.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [let](<https://devfeed.tech/tags/let.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [scope](<https://devfeed.tech/tags/scope.md>), [scope-function](<https://devfeed.tech/tags/scope-function.md>), [transformation](<https://devfeed.tech/tags/transformation.md>)

### AI overview

A reference guide to Kotlin's let() scope function. It explains how the receiver object is passed as the lambda argument, how let() returns the code block's result, and how it can transform objects. It also compares let() with direct property or function access, extension functions, and map().

### Source excerpt

Overview The let() function is one of a handful of scope functions defined in the Kotlin standard library. Example val size = "Hello".let { println(it) it.length } In this example, the string "Hello" is printed, and then its length is assigned to the size variable. Characteristics When the let() extension function executes: the receiver object that .let() is called upon is available as the lambda argument - by default, named it the result of let() will be the result of the code block passed to it Transformation The let() method is frequently used to transform an object.

## Function Reference

DevFeed: [Function Reference](<https://devfeed.tech/articles/function-reference-25014.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/function-reference/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-01T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [alternatives](<https://devfeed.tech/tags/alternatives.md>), [class](<https://devfeed.tech/tags/class.md>), [function](<https://devfeed.tech/tags/function.md>), [function-reference](<https://devfeed.tech/tags/function-reference.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [reference](<https://devfeed.tech/tags/reference.md>)

### AI overview

This Kotlin reference explains how function references work, including assigning, passing, and returning functions. It covers bound and unbound references, top-level and local references, receiver expressions, and alternatives such as lambdas.

### Source excerpt

Overview Kotlin supports the notion of first-class functions - functions can be saved to variables, passed into functions, and returned from functions. When you need to do this, you can create lambdas - function literals - or you can refer to an existing function by means of a function reference. Usage Assigning a function: class Example { fun add(a: Int, b: Int) = a + b val operation = this::add } Passing a function: