digitalmars.D.learn - Continuous integral range predicate
- =?UTF-8?B?Tm9yZGzDtnc=?= (4/4) Mar 31 2016 Is there a function in Phobos to check if a range of integral
- Rene Zwanenburg (3/7) Mar 31 2016 (untested)
- =?UTF-8?B?Tm9yZGzDtnc=?= (4/5) Mar 31 2016 Correction: Should be:
Is there a function in Phobos to check if a range of integral elements is adjacent, that is x[i+1] == x[i] + 1 where x[i] is the i:th element of the range.
Mar 31 2016
On Thursday, 31 March 2016 at 11:33:36 UTC, Nordlöw wrote:Is there a function in Phobos to check if a range of integral elements is adjacent, that is x[i+1] == x[i] + 1 where x[i] is the i:th element of the range.(untested) std.algorithm.findAdjacent!((a, b) => a != b+1)(range).empty;
Mar 31 2016
On Thursday, 31 March 2016 at 11:41:17 UTC, Rene Zwanenburg wrote:std.algorithm.findAdjacent!((a, b) => a != b+1)(range).empty;Correction: Should be: std.algorithm.findAdjacent!((a, b) => a+1 != b)(range).empty; Thanks!
Mar 31 2016