Re: C++ / Why Iterators Got It All Wrong

2017-09-11 Thread jmh530 via Digitalmars-d
On Monday, 11 September 2017 at 05:41:37 UTC, Ilya Yaroshenko wrote: Another small difference is slicing: For example, for contiguous matrix m: 1. m[a .. b] is contiguous 2. m[i] is contiguous 3. m[a .. b, i] is universal (because there are no 1D canonical slices) 4.

Re: C++ / Why Iterators Got It All Wrong

2017-09-10 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 7 September 2017 at 20:46:22 UTC, jmh530 wrote: On Thursday, 7 September 2017 at 12:28:00 UTC, jmh530 wrote: On Thursday, 7 September 2017 at 12:27:19 UTC, jmh530 wrote: auto x = data.sliced(2, 3).universal; Err, (3, 4) not (2, 3) All kinds of screwed up. This is what I get

Re: C++ / Why Iterators Got It All Wrong

2017-09-07 Thread jmh530 via Digitalmars-d
On Thursday, 7 September 2017 at 12:28:00 UTC, jmh530 wrote: On Thursday, 7 September 2017 at 12:27:19 UTC, jmh530 wrote: auto x = data.sliced(2, 3).universal; Err, (3, 4) not (2, 3) All kinds of screwed up. This is what I get for not testing things before I post them. unittest {

Re: C++ / Why Iterators Got It All Wrong

2017-09-07 Thread jmh530 via Digitalmars-d
On Thursday, 7 September 2017 at 12:27:19 UTC, jmh530 wrote: auto x = data.sliced(2, 3).universal; Err, (3, 4) not (2, 3)

Re: C++ / Why Iterators Got It All Wrong

2017-09-07 Thread jmh530 via Digitalmars-d
On Thursday, 7 September 2017 at 12:04:12 UTC, jmh530 wrote: I think what's missing from the documentation is a clear explanation of how the strides determine how the iterator moves. Even something like below (assuming I have the math right) would be an improvement, though I'm sure there is

Re: C++ / Why Iterators Got It All Wrong

2017-09-07 Thread jmh530 via Digitalmars-d
On Thursday, 7 September 2017 at 09:40:40 UTC, Ilya Yaroshenko wrote: For example, lets takes `transposed` function. It does not transpose the date. Instead, it swap dimensions. Assume you have a canonical matrix with _lengths = [3, 4]. So its strides are [4]. Now we want to swap dimensions,

Re: C++ / Why Iterators Got It All Wrong

2017-09-07 Thread Ilya Yaroshenko via Digitalmars-d
On Wednesday, 6 September 2017 at 21:44:01 UTC, jmh530 wrote: On Wednesday, 6 September 2017 at 20:24:05 UTC, Enamex wrote: Similarly, a[0] has _strides [4, 1] for universal, [4] for canonical, and [] for contiguous. Mir is written in such a way that a[0] the same regardless of the SliceKind.

Re: C++ / Why Iterators Got It All Wrong

2017-09-06 Thread jmh530 via Digitalmars-d
On Wednesday, 6 September 2017 at 20:24:05 UTC, Enamex wrote: On Sunday, 3 September 2017 at 09:24:03 UTC, Ilya Yaroshenko wrote: 1. Contiguous tensors. Their data is located contiguously in memory. Single dense memory chunk. All strides between subs-tensors can be computed from lengths. 2.

Re: C++ / Why Iterators Got It All Wrong

2017-09-06 Thread Enamex via Digitalmars-d
On Sunday, 3 September 2017 at 09:24:03 UTC, Ilya Yaroshenko wrote: 1. Contiguous tensors. Their data is located contiguously in memory. Single dense memory chunk. All strides between subs-tensors can be computed from lengths. 2. Canonical tensors. Only data for one dimension is dense, other

Re: C++ / Why Iterators Got It All Wrong

2017-09-06 Thread jmh530 via Digitalmars-d
On Wednesday, 6 September 2017 at 06:57:25 UTC, Ola Fosheim Grøstad wrote: Well, «C++ iterators» are table pointer abstractions, so you need a pair. An «iterator» would be a possibly heavy object that is used for traversing a possibly complex and heterogenous data-structure without

Re: C++ / Why Iterators Got It All Wrong

2017-09-06 Thread Ola Fosheim Grøstad via Digitalmars-d
On Monday, 4 September 2017 at 04:29:36 UTC, Ilya wrote: Maybe I should call it cursors or generic pointers instead of iterators. Well, «C++ iterators» are table pointer abstractions, so you need a pair. An «iterator» would be a possibly heavy object that is used for traversing a possibly

Re: C++ / Why Iterators Got It All Wrong

2017-09-05 Thread Mark via Digitalmars-d
On Saturday, 2 September 2017 at 20:22:44 UTC, Robert M. Münch wrote: Iterators are not the silver bullet. But IIRC you can specify if you want to iterate over a graph BF or DF. If you just need to "iterate" over the elements things work pretty good IMO. If you want to select a sub-set and

Re: C++ / Why Iterators Got It All Wrong

2017-09-04 Thread Mark via Digitalmars-d
On Sunday, 3 September 2017 at 12:46:05 UTC, Moritz Maxeiner wrote: I agree, though I was talking about what the abstract data type of a "series" is, i.e. what operations is exposes. From my observation: A D input range exposes via empty/front/popFront. A classic iterator exposes via

Re: C++ / Why Iterators Got It All Wrong

2017-09-04 Thread Robert M. Münch via Digitalmars-d
On 2017-09-03 12:46:05 +, Moritz Maxeiner said: I'll put in on my ever growing list of things to check out in depth, thanks :p You're welcome. Don't wait to long ;-) There is no difference between code & data in Rebol. And it has a very rich set of datatpye, IIRC about 35 native ones.

Re: C++ / Why Iterators Got It All Wrong

2017-09-04 Thread jmh530 via Digitalmars-d
On Monday, 4 September 2017 at 04:29:36 UTC, Ilya wrote: Maybe I should call it cursors or generic pointers instead of iterators. dcollections uses a cursor approach that seems different from yours https://github.com/schveiguy/dcollections/blob/master/concepts.txt Maybe generic pointers

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Ilya via Digitalmars-d
On Sunday, 3 September 2017 at 16:33:04 UTC, Moritz Maxeiner wrote: On Sunday, 3 September 2017 at 14:19:19 UTC, Ilya Yaroshenko wrote: Ranges requires for 25% more space for canonical matrixes then iterators. We do have to differentiate between a container and the API with which to iterate

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 3 September 2017 at 14:19:19 UTC, Ilya Yaroshenko wrote: On Sunday, 3 September 2017 at 12:35:16 UTC, Moritz Maxeiner wrote: On Sunday, 3 September 2017 at 09:24:03 UTC, Ilya Yaroshenko wrote: On Sunday, 3 September 2017 at 02:43:51 UTC, Moritz Maxeiner wrote: On Sunday, 3 September

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Ilya Yaroshenko via Digitalmars-d
On Sunday, 3 September 2017 at 12:35:16 UTC, Moritz Maxeiner wrote: On Sunday, 3 September 2017 at 09:24:03 UTC, Ilya Yaroshenko wrote: On Sunday, 3 September 2017 at 02:43:51 UTC, Moritz Maxeiner wrote: On Sunday, 3 September 2017 at 02:08:20 UTC, Ilya Yaroshenko wrote: On Tuesday, 29 August

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 3 September 2017 at 08:37:36 UTC, Robert M. Münch wrote: On 2017-09-02 21:27:58 +, Moritz Maxeiner said: Thanks for your post about Rebol, I didn't know it before. As said, the official Rebol-2 version is a dead-end. Even our main product is still based on it :-) 15 years old

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 3 September 2017 at 09:24:03 UTC, Ilya Yaroshenko wrote: On Sunday, 3 September 2017 at 02:43:51 UTC, Moritz Maxeiner wrote: On Sunday, 3 September 2017 at 02:08:20 UTC, Ilya Yaroshenko wrote: On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest:

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Ilya Yaroshenko via Digitalmars-d
On Sunday, 3 September 2017 at 02:43:51 UTC, Moritz Maxeiner wrote: On Sunday, 3 September 2017 at 02:08:20 UTC, Ilya Yaroshenko wrote: On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read

Re: C++ / Why Iterators Got It All Wrong

2017-09-03 Thread Robert M. Münch via Digitalmars-d
On 2017-09-02 21:27:58 +, Moritz Maxeiner said: Thanks for your post about Rebol, I didn't know it before. As said, the official Rebol-2 version is a dead-end. Even our main product is still based on it :-) 15 years old technology, but still working and we know all problemes. So very

Re: C++ / Why Iterators Got It All Wrong

2017-09-02 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 3 September 2017 at 02:08:20 UTC, Ilya Yaroshenko wrote: On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. Iterators has

Re: C++ / Why Iterators Got It All Wrong

2017-09-02 Thread Ilya Yaroshenko via Digitalmars-d
On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. Iterators has no proper alternative when one need to implement generic tensor

Re: C++ / Why Iterators Got It All Wrong

2017-09-02 Thread Moritz Maxeiner via Digitalmars-d
On Saturday, 2 September 2017 at 20:17:40 UTC, Robert M. Münch wrote: On 2017-08-31 07:13:55 +, drug said: Interesting. How is it comparable with iterators and ranges ideas? Well, see: http://www.rebol.com/docs/core23/rebolcore-6.html#section-6 Thanks for your post about Rebol, I

Re: C++ / Why Iterators Got It All Wrong

2017-09-02 Thread Robert M. Münch via Digitalmars-d
On 2017-09-01 20:34:32 +, Mark said: On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. Iterators have many problems. Andrei's

Re: C++ / Why Iterators Got It All Wrong

2017-09-02 Thread Robert M. Münch via Digitalmars-d
On 2017-08-31 07:13:55 +, drug said: Interesting. How is it comparable with iterators and ranges ideas? Well, see: http://www.rebol.com/docs/core23/rebolcore-6.html#section-6 Just download the interpreter and play around with it to get a feeling. Overall it's way more functional. Like

Re: C++ / Why Iterators Got It All Wrong

2017-09-01 Thread Mark via Digitalmars-d
On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. Iterators have many problems. Andrei's talk some years ago, titled "Iterators

Re: C++ / Why Iterators Got It All Wrong

2017-08-31 Thread drug via Digitalmars-d
31.08.2017 09:50, Robert M. Münch пишет: On 2017-08-29 13:23:50 +, Steven Schveighoffer said: ... In Phobos, find gives you a range where the first element is the one you searched for, and the last element is the end of the original range. But what if you wanted all the data *up to* the

Re: C++ / Why Iterators Got It All Wrong

2017-08-31 Thread Robert M. Münch via Digitalmars-d
On 2017-08-29 13:23:50 +, Steven Schveighoffer said: ... In Phobos, find gives you a range where the first element is the one you searched for, and the last element is the end of the original range. But what if you wanted all the data *up to* the element instead? What if you just wanted

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread Steven Schveighoffer via Digitalmars-d
On 8/29/17 9:34 AM, jmh530 wrote: On Tuesday, 29 August 2017 at 13:23:50 UTC, Steven Schveighoffer wrote: Interesting. It reminds me a bit of cursors for dcollections. In there, a cursor is a 0 or 1 element range. The one element range points at an element, the 0 element range points at a

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread jmh530 via Digitalmars-d
On Tuesday, 29 August 2017 at 13:23:50 UTC, Steven Schveighoffer wrote: Interesting. It reminds me a bit of cursors for dcollections. In there, a cursor is a 0 or 1 element range. The one element range points at an element, the 0 element range points at a border. You can use cursors to

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 13:23:50 UTC, Steven Schveighoffer wrote: In Phobos, find gives you a range where the first element is the one you searched for, and the last element is the end of the original range. But what if you wanted all the data *up to* the element instead? What if you

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread Steven Schveighoffer via Digitalmars-d
On 8/29/17 8:50 AM, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. Interesting. It reminds me a bit of cursors for dcollections. In there, a cursor is a 0 or 1 element

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. "superseded" is the wrong word, as ranges cannot do everything iterators can.

C++ / Why Iterators Got It All Wrong

2017-08-29 Thread Robert M. Münch via Digitalmars-d
Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. -- Robert M. Münch http://www.saphirion.com smarter | better | faster