www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6110] New: std.functional: unaryFun should take an array alias.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6110

           Summary: std.functional: unaryFun should take an array alias.
           Product: D
           Version: future
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



I find myself writing code similar to the following quite a lot:

auto bbb = new bool[MAX];
auto arr = new int[MAX];
//...
writeln(filter!((a){return bbb[a];})(arr));

I think that it should be possible to do
writeln(filter!bbb(arr));

for the same effect.

It is generally useful to use an array as a function that maps integral indexes
to the element type of the array.

Therefore, I propose to improve unaryFun so that it implements the proposed
semantics.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 05 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6110


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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