Skip to content

string_repeat builtin #213

@aallan

Description

@aallan

Add a string_repeat builtin for repeating a string N times.

Proposed function

  • string_repeat(@String, @Nat -> @String) -- repeat string N times

Rationale

Building repeated patterns (padding, separators, indentation) currently requires recursive functions with manual string_concat calls. A dedicated builtin is simpler and more efficient.

Implementation notes

Allocate length * N bytes, copy the source string N times in a loop. Pure function.

Dependencies

  • None

Metadata

Metadata

Assignees

No one assigned

    Labels

    C8.5C8.5 — CompletenesscodegenCode generation backendenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions