-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: add foreach
function
#13774
RFC: add foreach
function
#13774
Conversation
+1. I frequently define this function locally |
Yeah, seems good to me too. |
Should it be called |
+1. I think it should be Related... are there methods to map many functions to one input? Should On Mon, Oct 26, 2015 at 10:54 AM, Stefan Karpinski <notifications@github.com
|
+1, for the doc maybe a note when you should use |
+1, I would use this. But it does mean that |
Those syntax differences seem to matter a lot to people. |
Agreed all around. |
NEWS for `foreach` [ci skip]
8c10347
to
71fc3b3
Compare
RFC: add `foreach` function
I'm glad to see |
Function first is consistent with map and allows do block notation. |
The do block notation is a compelling reason to have it (if do blocks require function first in order to work), but consistency with map isn't. Map reads "map this function to these items". |
I don't think debating the subjectively best order of arguments is likely to prove productive. |
@johnmyleswhite you're right. Sorry for following up. |
A few times I have seen
map
used with a function called only for side effects, for examplemap(println, x)
. This returns a noisy and unnecessary array of nothings. I think we should have aforeach
function (ala Scheme) for cases like this.