Talk:DIP69

From D Wiki
Revision as of 18:52, 15 February 2015 by Bearophile (talk | contribs) (One example bug)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See one bug that DIP69 (or similar proposals) must help remove from D code: http://forum.dlang.org/post/zpuriaktffctmnljuprq@forum.dlang.org

   import std.range, std.algorithm, std.stdio;
   
   void foo(float[] data, float[] xs, float[] ys)
   {
       auto indices = iota(0, data.length, ys.length)
           .map!(xBase =>
                   iota(xBase, xBase + ys.length - 1)
                   .map!(y =>
                       only(y, y+ys.length, y+ys.length+1, y+1))
                   .joiner())
           .joiner();
       writeln(indices);
   }
   
   void main()
   {
       foo([1,2,3,4,5,6,7,8],
               [0.1,0.2], [10,20,30,40]);
   }