Skip to content

About reassignment by activej-codegen #297

Discussion options

You must be logged in to vote
    val cb2: ClassBuilder<Function<Any?, Any?>> =
        ClassBuilder.create(Function::class.java).self()
    cb2.withMethod(
        "apply",
        let(cast(arg(0), Array::class.java)) { arr ->
            let(value(0)) { v ->
                sequence(
                    iterateArray(arr) {
                        call(staticField(System::class.java, "out"), "println", it)
                    },
                    // == HELP ==
                    // How to accumulate and return 1 + 2 + 3
                    add(v, cast(arrayGet(arr, value(0)), Int::class.java))
                    , v
                )
            }
        }
    )
    val c2 = cb2.defineClass(classLoader)
    pri…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@zhangtianxiao
Comment options

Comment options

You must be logged in to vote
1 reply
@zhangtianxiao
Comment options

Answer selected by zhangtianxiao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants