digitalmars.D.learn - ndslice help
- Zz (13/13) Feb 17 2016 Hi,
- ZombineDev (14/27) Feb 17 2016 Here's my solution:
- Zz (3/37) Feb 18 2016 Thanks
Hi, I'm trying to generate the following sequences with ndslice. 0 0 0 1 1 1 1 1 1 0 0 0 0 1 2 0 1 2 2 1 0 2 1 0 It's okay with loops but was checking to see if it's possible with ndslice. Zz
Feb 17 2016
On Thursday, 18 February 2016 at 00:25:09 UTC, Zz wrote:Hi, I'm trying to generate the following sequences with ndslice. 0 0 0 1 1 1 1 1 1 0 0 0 0 1 2 0 1 2 2 1 0 2 1 0 It's okay with loops but was checking to see if it's possible with ndslice. ZzHere's my solution: http://dpaste.dzfl.pl/29676608fd88 The best part about ndslice is that you can use the ordinary slice operations with it like: http://dlang.org/spec/arrays.html#array-copying, http://dlang.org/spec/arrays.html#array-setting, http://dlang.org/spec/arrays.html#array-operations, etc. and also leverage the existing ranges, range transformations and algorithms from http://dlang.org/phobos/std_range and http://dlang.org/phobos/std_algorithm. In addition, I used nested array formatting with http://dlang.org/phobos/std_format.
Feb 17 2016
On Thursday, 18 February 2016 at 02:24:20 UTC, ZombineDev wrote:On Thursday, 18 February 2016 at 00:25:09 UTC, Zz wrote:Thanks ZzHi, I'm trying to generate the following sequences with ndslice. 0 0 0 1 1 1 1 1 1 0 0 0 0 1 2 0 1 2 2 1 0 2 1 0 It's okay with loops but was checking to see if it's possible with ndslice. ZzHere's my solution: http://dpaste.dzfl.pl/29676608fd88 The best part about ndslice is that you can use the ordinary slice operations with it like: http://dlang.org/spec/arrays.html#array-copying, http://dlang.org/spec/arrays.html#array-setting, http://dlang.org/spec/arrays.html#array-operations, etc. and also leverage the existing ranges, range transformations and algorithms from http://dlang.org/phobos/std_range and http://dlang.org/phobos/std_algorithm. In addition, I used nested array formatting with http://dlang.org/phobos/std_format.
Feb 18 2016