as Proposal
This extension function offers a short, convenience method to use a static List as Proposal.
As default behaviour it checks, whether the current draft is contained in any item of the list ignoring case sensitivity:
val languages = listOf("Kotlin", "Scala", "Java", "OCaml", "Haskell")
val proposal = languages.asProposal() // called with draft = "ca" -> ["Scala", "OCaml"]
// ^^ ^^A predicate factory for the filter function can be passed as optional parameter:
// just take only items from the list, that starts with draft:
languages.asProposal { draft -> { item -> item.startsWith(draft) } }
@param predicate a factory for a predicate function applied to the internal filter; the current draft is the
outer parameter, the inner one is the current element of the list.