Skip to content

Feature request: something equivalent to "Array.prototype.fill" from ES6 #1

@PaulRBerg

Description

@PaulRBerg

See Array.prototype.fill. When used like this in JavaScript:

Array(5).fill(2)

It will yield the following output:

[2, 2, 2, 2, 2]

It seems to me that solidity-generators would be the right place to implement such a functionality in Solidity (better than forge-std).

The way I see it, there are a couple ways this could be implemented:

  1. Add a new function fill that does only this.
  2. Modify the behavior of linspace to continue filling the output with duplicated values of the second argument (ustop).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions