Skip to content

Bug in builder-like functionality #1961

Description

@steeling
schema Builder:
    statements: [str] = []

    add: (str) = lambda v: str {
        stmts = statements + [v]
        Builder{statements = stmts}
    }

    build: () = lambda {
        " ".join(statements)
    }


test = lambda {
    b = Builder{}
    b = b.add("hello")
    b = b.add("world")
    b = b.add("!")
    b.build()
}

out = test()

output:

out: hello hello

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions