-
Notifications
You must be signed in to change notification settings - Fork 18k
Variadic parameters don't work if some of the args are expended and some aren't #2873
New issue
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
Labels
Comments
Sorry about that. http://play.golang.org/p/-KLRKJqXoa Expected output is: Rfold 15 Lfold 15 |
To avoid confusion about what slice is being passed, the ... syntax only applies when it is providing the entire ... argument; you can't splice in additional parameters with it. You can use an explicit append instead: return LfoldInt(op, append([]int{op(a, b)}, ints[2:]...)...) However, for this specific case, I'd suggest writing foldl and foldr this way: http://play.golang.org/p/C6d3gM44FF Russ Status changed to WorkingAsIntended. |
Sorry, typo: http://play.golang.org/p/A4DypCG_cV |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by ficoos:
The text was updated successfully, but these errors were encountered: