Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dss:laboratoare:01 [2019/08/14 14:34]
razvan.nitu1305 [Data Types]
dss:laboratoare:01 [2019/08/14 15:07] (current)
razvan.nitu1305 [Unittests]
Line 418: Line 418:
 <code D> <code D>
 import std.algorithm : group; import std.algorithm : group;
-import std.range : chain, ​retro, front, retro;+import std.range : chain, ​dropOne, front, retro;
 [1, 2].chain([3,​ 4]).retro; // 4, 3, 2, 1 [1, 2].chain([3,​ 4]).retro; // 4, 3, 2, 1
-[1, 1, 2, 2, 2].group.dropOne.front;​ // (2, 3) +[1, 1, 2, 2, 2].group.dropOne.front;​ // (2, 3) 
 + 
 +front(dropOne(group([1,​ 1, 2, 2, 2]))); ​
 </​code>​ </​code>​
  
Line 521: Line 523:
  
 <code D> <code D>
-class Sum+struct ​Sum
 { {
     int add(int x, int y) { return x + y; }     int add(int x, int y) { return x + y; }
Line 527: Line 529:
     unittest     unittest
     {     {
-        Sum sum = new Sum;+        Sum sum;
         assert(sum.add(3,​4) == 7);         assert(sum.add(3,​4) == 7);
         assert(sum.add(-2,​0) == -2);         assert(sum.add(-2,​0) == -2);
dss/laboratoare/01.1565782468.txt.gz · Last modified: 2019/08/14 14:34 by razvan.nitu1305
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0