Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import std.stdio;
  2. import std.array;
  3. import std.algorithm;
  4. import std.range;
  5. import std.conv;
  6. import std.typecons;
  7.  
  8. static bool even(Tuple!(ulong, double) a) {
  9. return (a[0] & 1) == 0;
  10. }
  11.  
  12. void main() {
  13. double[] arr = [31, 22, -3, 44, 51, 26, 47, 58, 19, 10];
  14. auto res1 = arr.enumerate.filter!(even).map!(a => a[1]);
  15. writeln(res1);
  16. writeln(__VERSION__);
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement