qtil
advanced-security/qtil-swift 0.0.3
Search

Module TypedListBuilder

A module that declares predicates of2(...) to of8(...) for building a type that extends string from a list of string-valued arguments separated by a custom separator.

To build a string (rather than a type that extends string) from a list of string-valued arguments, use ListBuilder<separator>. To build a string from non-string arguments, use ListBuilderOf<separator, T, toString>. To build a type that extends string from non-string arguments, use TypedListBuilderOf<separator, T, S, toString>.

Example usage:

bindingset[this]
class MyString extends string {
  bindingset[this]
  string reverse() {
    result = concat(string c, int idx | c = this.charAt(idx) | c order by idx desc)
  }
}

// Selects "rab,oof".
// Resulting type is of `MyString`, which allows for the `.reverse()` member predicate here.
select TypedListBuilder<Separator::comma/0, MyString>
    ::of2("foo", "bar")
    .reverse()

Import path

import qtil.list.ListBuilder

Imports

TypedListBuilderOf<TypedListBuilder::separator, TypedListBuilder::S, string, TypedListBuilder::identity>

A module that declares predicates of2(...) to of8(...) for building a type that extends string from a list of arguments of a custom type T, converted to strings via the toString predicate, using a custom separator.

Parameters