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
Let's add a companion to array.map and we can bask in our functional goodness.
main { square = (x) => x*x; sum = (x) => x+x; sumSquares = a => a.map(square).reduce(sum); puts(sumSquares([1,2,3])); // 14 }
Ideally, the output of map can be piped into reduce without first creating an intermediary array, so that the compiled code is more of this form:
sumSquares(a) { for(i in a) { mapped = i*i; reduced = reduced+mapped; } return reduced; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Let's add a companion to array.map and we can bask in our functional goodness.
Ideally, the output of map can be piped into reduce without first creating an intermediary array, so that the compiled code is more of this form:
The text was updated successfully, but these errors were encountered: