parameter
Used to declare a parameter with the supplied arguments.
val letter by parameter('a'..'z')Content copied to clipboard
See also
inline fun <T> ParameterizeScope.parameter(crossinline lazyArguments: LazyParameterScope.() -> Sequence<T>): ParameterizeScope.Parameter<T>(source)
inline fun <T> ParameterizeScope.parameter(crossinline lazyArguments: LazyParameterScope.() -> Iterable<T>): ParameterizeScope.Parameter<T>(source)
Used to declare a parameter with the computed lazyArguments. The arguments are only computed the first time the parameter is used, and not at all if used.
This parameter function is useful to avoid computing the arguments every iteration. Instead, these arguments will only be computed the first time the parameter is used.
val evenNumberSquared by parameter {
numbers
.filter { it % 2 == 0 }
.map { it * it }
}Content copied to clipboard