asad.awadia

    asad.awadia

    2 years ago
    is there a way to generate a giant when clause - given a List of predicates?
    Dominaezzz

    Dominaezzz

    2 years ago
    At runtime?
    asad.awadia

    asad.awadia

    2 years ago
    either is fine
    Dominaezzz

    Dominaezzz

    2 years ago
    You can use kotlinpoet to generate the source code from the List.
    asad.awadia

    asad.awadia

    2 years ago
    no no I dont want code gen like that
    Dominaezzz

    Dominaezzz

    2 years ago
    Oh. I guess you can just loop through the predicates at runtime and call them?
    Derek Peirce

    Derek Peirce

    2 years ago
    It would be interesting to have some sort of
    inline list
    feature that let you automatically unroll a loop over a set of elements, like
    inlineList(a, b, c).forEach { println(it) }
    that compiled to
    println(a); println(b); println(c)
    j

    jimn

    2 years ago
    enum is compact at bundling predicate dispatch