Jump to page: 1 26  
Page
Thread overview
DTL Update [was Re: Some food for thought]
Mar 20, 2004
Matthew
Mar 20, 2004
Phill
Mar 20, 2004
Ant
Mar 20, 2004
Matthew
Mar 20, 2004
Matthew
Mar 20, 2004
Matthew
Mar 20, 2004
C. Sauls
Mar 20, 2004
Matthew
Mar 21, 2004
Pablo Aguilar
Mar 21, 2004
Matthew
Mar 22, 2004
Pablo Aguilar
Mar 22, 2004
J Anderson
Mar 20, 2004
Matthew
Mar 20, 2004
Ben Hinkle
Mar 20, 2004
C. Sauls
Mar 20, 2004
Matthew
Mar 20, 2004
C
Mar 20, 2004
Matthew
Mar 21, 2004
Ben Hinkle
Mar 21, 2004
Walter
Mar 21, 2004
Matthew
Mar 21, 2004
Matthew
Mar 21, 2004
Walter
Mar 21, 2004
Matthew
Mar 21, 2004
John Reimer
Mar 24, 2004
J Anderson
Mar 21, 2004
Matthew
Mar 21, 2004
Matthew
Mar 21, 2004
J Anderson
Mar 21, 2004
Ben Hinkle
Mar 22, 2004
J Anderson
Mar 21, 2004
Patrick Down
Mar 21, 2004
resistor
Mar 21, 2004
Matthew
Mar 21, 2004
resistor
Mar 22, 2004
J Anderson
Mar 22, 2004
C
Mar 22, 2004
J Anderson
Mar 21, 2004
Matthew
Mar 20, 2004
J Anderson
Mar 21, 2004
Matthew
Mar 22, 2004
John Reimer
Mar 23, 2004
Phill
Mar 23, 2004
Matthew
Mar 23, 2004
John Reimer
[OT] accents [was Re: DTL Update [was Re: Some food for thought]]
Mar 24, 2004
Alix Pexton
Mar 25, 2004
Kris
Mar 23, 2004
Matthew
March 20, 2004
> What is the equivalent of Java's Vector in D?

The DTL's Vector!! :)

I've sent Walter the first pieces of the DTL, and am waiting for his thoughts.

The current state is that we have several containers - Vector, Queue, Stack, List (double) and Map - which are able to contain things, and do "normal" operations for their kind:

    - subscripting and foreach for Vector
    - push, pop, top and foreach for Stack
    - push, pop, top and foreach for Queue
    - "subscript" operator, keys(), values(), containsKey(),
containsValue(), erase(), clear() and foreach for Map
    - push_front/back(), pop_front/back(), front(), back() and foreach for
List

[
    Note that the Map's foreach returns key&value pairs, which the built-in
assoc arrays do not, so we get to do this:

    Map!(int, int).Map    m;
    . . .
    foreach(map_t.pair_type p; m)
    {
        printf("[%d]: %d ", p.key, p.value);
    }

    I don't know about anyone else, but this is much more convenient for
most times I want to use a map. You can still enumerate just the values or
just the keys, by

    foreach(map_t.key_type k; m.keys)
    {
        printf("[%d] ", k);
    }

    foreach(map_t.value_type v; m.values)
    {
        printf("[]: %d ", v);
    }

]


There's also an IntRange, which I mentioned in a recent post will support a relativelt succint syntax

    foreach(int i; new IntRange(-20, +20, 2))
    {
        . . .
    }

This'll be turned into a template soon so that it will work with any integral type.

There are a couple more containers to do - SList and Set, and we'll also take requests.

The next big thing is to work out how the Range concept - which I've been working on in C++ with John Torjo - can be integrated over into the DTL, and to work seamlessly with the built-in slicing. This is what I want to get through with Walter before releasing. I've been fannying on about this for some time, but I'll get it all done with big-W's foot up my arse pretty soon, I'm sure. [Ranges is going to be a big feature in my next book - "Extended STL" (mainly C++, but also D & .NET) - and I need to start on that soonish.]

I'm interested to hear know whether people would like an early release as it is now, since they're moderately well tested and usable within the available interfaces described above, or wait for the full Monty is a couple of weeks' time?

Cheers

Matthew



March 20, 2004
"Matthew" <matthew@stlsoft.org> wrote in message news:c3gplm$1v69$1@digitaldaemon.com...
> > What is the equivalent of Java's Vector in D?
>
> The DTL's Vector!! :)

Thats great!

> The next big thing is to work out how the Range concept - which I've been working on in C++ with John Torjo - can be integrated over into the DTL,
and
> to work seamlessly with the built-in slicing. This is what I want to get through with Walter before releasing. I've been fannying on about this for some time, but I'll get it all done with big-W's foot up my arse pretty soon, I'm sure.

LOL

> I'm interested to hear know whether people would like an early release as
it
> is now, since they're moderately well tested and usable within the
available
> interfaces described above, or wait for the full Monty is a couple of
weeks'
> time?

I'd be interested to get access to an early release.

Everything sounds great!

Phill.




> Cheers
>
> Matthew
>
>
>


March 20, 2004
On Sat, 20 Mar 2004 06:51:24 +0000, Matthew wrote:

>> What is the equivalent of Java's Vector in D?
> 
>     Note that the Map's foreach returns key&value pairs, which the built-in
> assoc arrays do not, so we get to do this:
> 
>
>    Map!(int, int).Map    m;
>    . . .
>    foreach(map_t.pair_type p; m)
>    {
>        printf("[%d]: %d ", p.key, p.value);
>    }

they do, no need for that.

	int[int] m;
	. . .
	foreach(int key, int value ; m)
	{
		printf("[%d] %d\n", key, value);
	}


I fail to see the necessity of Map at all...

I'll wait to see.

>    foreach(int i; new IntRange(-20, +20, 2))
    foreach(int i; Range!(int)(-20, +20, 2))

why is this better then:

     for(int i=-20; i<20 ; i+=2)



Ant



March 20, 2004
"Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.03.20.07.35.36.332897@yahoo.ca...
> On Sat, 20 Mar 2004 06:51:24 +0000, Matthew wrote:
>
> >> What is the equivalent of Java's Vector in D?
> >
> >     Note that the Map's foreach returns key&value pairs, which the
built-in
> > assoc arrays do not, so we get to do this:
> >
> >
> >    Map!(int, int).Map    m;
> >    . . .
> >    foreach(map_t.pair_type p; m)
> >    {
> >        printf("[%d]: %d ", p.key, p.value);
> >    }
>
> they do, no need for that.
>
> int[int] m;
> . . .
> foreach(int key, int value ; m)
> {
> printf("[%d] %d\n", key, value);
> }

Since when? I remember have multiple debates with Walter to have this feature, and they were rejected. Are you sure?

> I fail to see the necessity of Map at all...

If you're correct, then there is no need for Map.

> I'll wait to see.
>
> >    foreach(int i; new IntRange(-20, +20, 2))
>     foreach(int i; Range!(int)(-20, +20, 2))
>
> why is this better then:
>
>      for(int i=-20; i<20 ; i+=2)

Pure syntactic sugar in the case of int, but it's a unifying thing that people want. It serves a genuine need, however, since it facilitates generic programming for freachable entities and integral ranges.

I'm off to test your key/val assertion ...


March 20, 2004
Well, you could knock me down with a feather!

You're quite right, and I can ditch Map. Shame I spend several hours on it. :(

Walter and I had several exchanges on this during the time we were writing the Dr Dobb's article. I must have missed the update.

Ho hum. Anyone got any more wild geese that need chasing?


"Matthew" <matthew@stlsoft.org> wrote in message news:c3gth8$25fs$1@digitaldaemon.com...
>
> "Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.03.20.07.35.36.332897@yahoo.ca...
> > On Sat, 20 Mar 2004 06:51:24 +0000, Matthew wrote:
> >
> > >> What is the equivalent of Java's Vector in D?
> > >
> > >     Note that the Map's foreach returns key&value pairs, which the
> built-in
> > > assoc arrays do not, so we get to do this:
> > >
> > >
> > >    Map!(int, int).Map    m;
> > >    . . .
> > >    foreach(map_t.pair_type p; m)
> > >    {
> > >        printf("[%d]: %d ", p.key, p.value);
> > >    }
> >
> > they do, no need for that.
> >
> > int[int] m;
> > . . .
> > foreach(int key, int value ; m)
> > {
> > printf("[%d] %d\n", key, value);
> > }
>
> Since when? I remember have multiple debates with Walter to have this feature, and they were rejected. Are you sure?
>
> > I fail to see the necessity of Map at all...
>
> If you're correct, then there is no need for Map.
>
> > I'll wait to see.
> >
> > >    foreach(int i; new IntRange(-20, +20, 2))
> >     foreach(int i; Range!(int)(-20, +20, 2))
> >
> > why is this better then:
> >
> >      for(int i=-20; i<20 ; i+=2)
>
> Pure syntactic sugar in the case of int, but it's a unifying thing that people want. It serves a genuine need, however, since it facilitates
generic
> programming for freachable entities and integral ranges.
>
> I'm off to test your key/val assertion ...
>
>


March 20, 2004
Nope. I've just checked, and I must be even more dense that was previously suspected. Dr, heal thyself! :(

Apologies all round, not least of which to my finger joints for all that unnecessary typing.


"Matthew" <matthew@stlsoft.org> wrote in message news:c3gtmi$2632$1@digitaldaemon.com...
> Well, you could knock me down with a feather!
>
> You're quite right, and I can ditch Map. Shame I spend several hours on
it.
> :(
>
> Walter and I had several exchanges on this during the time we were writing the Dr Dobb's article. I must have missed the update.
>
> Ho hum. Anyone got any more wild geese that need chasing?
>
>
> "Matthew" <matthew@stlsoft.org> wrote in message news:c3gth8$25fs$1@digitaldaemon.com...
> >
> > "Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.03.20.07.35.36.332897@yahoo.ca...
> > > On Sat, 20 Mar 2004 06:51:24 +0000, Matthew wrote:
> > >
> > > >> What is the equivalent of Java's Vector in D?
> > > >
> > > >     Note that the Map's foreach returns key&value pairs, which the
> > built-in
> > > > assoc arrays do not, so we get to do this:
> > > >
> > > >
> > > >    Map!(int, int).Map    m;
> > > >    . . .
> > > >    foreach(map_t.pair_type p; m)
> > > >    {
> > > >        printf("[%d]: %d ", p.key, p.value);
> > > >    }
> > >
> > > they do, no need for that.
> > >
> > > int[int] m;
> > > . . .
> > > foreach(int key, int value ; m)
> > > {
> > > printf("[%d] %d\n", key, value);
> > > }
> >
> > Since when? I remember have multiple debates with Walter to have this feature, and they were rejected. Are you sure?
> >
> > > I fail to see the necessity of Map at all...
> >
> > If you're correct, then there is no need for Map.
> >
> > > I'll wait to see.
> > >
> > > >    foreach(int i; new IntRange(-20, +20, 2))
> > >     foreach(int i; Range!(int)(-20, +20, 2))
> > >
> > > why is this better then:
> > >
> > >      for(int i=-20; i<20 ; i+=2)
> >
> > Pure syntactic sugar in the case of int, but it's a unifying thing that people want. It serves a genuine need, however, since it facilitates
> generic
> > programming for freachable entities and integral ranges.
> >
> > I'm off to test your key/val assertion ...
> >
> >
>
>


March 20, 2004
Matthew wrote:

> I'm interested to hear know whether people would like an early release as it
> is now, since they're moderately well tested and usable within the available
> interfaces described above, or wait for the full Monty is a couple of weeks'
> time?

Early release would be wonderful.

Cheers,
Sigbjørn Lund Olsen
March 20, 2004
Ok. I just want to hear back from Walter on the current implementations, and delete the Map one (LOL!), and then I'll do that.

The Range stuff that's in there so far is to be ignored, as it's likely to change significantly. I shouldn't really affect anyone, as long as you don't try to use it.

Cheers

Matthew

"Sigbjørn Lund Olsen" <sigbjorn@lundolsen.net> wrote in message news:c3h9k9$2tf9$1@digitaldaemon.com...
> Matthew wrote:
>
> > I'm interested to hear know whether people would like an early release
as it
> > is now, since they're moderately well tested and usable within the
available
> > interfaces described above, or wait for the full Monty is a couple of
weeks'
> > time?
>
> Early release would be wonderful.
>
> Cheers,
> Sigbjørn Lund Olsen


March 20, 2004
Hey don't worry about it, isn't that why we have this NG?  :)  Besides, you at least proved it can be done... good news to anybody who actually comes up with a need for a map-like object down the road.  Keep your code laying around somewhere.

Oh, and I wanna add my begging for the preview release.  :)

-C. Sauls
-Invironz
March 20, 2004
On Sat, 20 Mar 2004 06:51:24 -0000, "Matthew" <matthew@stlsoft.org> wrote:

>> What is the equivalent of Java's Vector in D?
>
>The DTL's Vector!! :)

I should probably wait until DTL is more baked, but...
why have a Vector class when we have dynamic arrays
in D already? Unless there are really good reasons
to have one we should avoid making a Vector class.

I can imagine a couple of possible reasons for Vector:
1) Vector subclasses some abstract list class or
   interface
2) Vector would use iterator classes to be consistent
   with other classes in DTL

Without seeing DTL it's kindof hard to imagine
satisfying 1 and 2 with "pure" dynamic arrays but
I really hope we don't just add a Vector class
because Java/C++ have one in their collections API.

-Ben
« First   ‹ Prev
1 2 3 4 5 6