We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See Array.prototype.fill. When used like this in JavaScript:
Array.prototype.fill
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).
solidity-generators
forge-std
The way I see it, there are a couple ways this could be implemented:
fill
linspace
ustop
The text was updated successfully, but these errors were encountered:
Agreed, this does seem like the right library for this method.
The existing function names/signatures are modeled after numpy's method's of the same name, so perhaps we base this one on the full method:
full
>>> np.full(5, 2) array([2, 2, 2, 2, 2])
function full(uint length, uint val) pure returns (uint[] memory arr) { // --- snip --- }
I won't be able to implement this until after the holidays, but PRs definitely welcome if you want it sooner
Sorry, something went wrong.
No branches or pull requests
See
Array.prototype.fill
. When used like this in JavaScript:It will yield the following output:
It seems to me that
solidity-generators
would be the right place to implement such a functionality in Solidity (better thanforge-std
).The way I see it, there are a couple ways this could be implemented:
fill
that does only this.linspace
to continue filling the output with duplicated values of the second argument (ustop
).The text was updated successfully, but these errors were encountered: