Skip to content

Function references

Jonathan edited this page Nov 17, 2018 · 1 revision
interface Seq<T> {
  fun map<R>(mapper: fun(T): R): Seq<R>
}

val mySeq: Seq<Int> = ...
val prefix = "N: "
mySeq.map(asString(_) with prefix)

fun asString(n: Int) :{
  With(prefix: String) =
    #{"{0}{1}" where 0 -> prefix, 1 -> n}
}

Clone this wiki locally