[Issue 11572] eager apply for ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 21 13:37:14 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11572


Dmitry Olshansky <dmitry.olsh at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh at gmail.com


--- Comment #2 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-11-21 13:37:11 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > The use-case
> > 
> > foreach (c; "foobar".retro())
> >     writeln(c);
> > 
> > "foobar".retro.apply!writeln();
> 
> This is a common need, perhaps such request is already in Bugzilla.
> 
> 
> > Not sure about the name, maybe sink or apply.
> 
> "sink" is probably better left for output ranges, etc.
> 
> "apply" function usually has another meaning:
> http://en.wikipedia.org/wiki/Apply
> 
> So I suggest names like "forEach", that underlines its imperative nature.

Simply each is enough and has precedents in other languages like Groovy and
Ruby.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list