On Saturday, 2 April 2016 at 16:00:29 UTC, Andrei Alexandrescu
wrote:
Work on containers has been on hold for three reasons:
1. Paper submission to a conference (more details soon)
2. DConf organizing stuff
3. RCString work, which can proceed in the current language
4. Work on a DIP that all
Has no one mentioned void[0][T] yet?
alias Set(T) = void[0][T];
void add(T)(ref void[0][T] set, T key) {
set[key] = (void[0]).init;
}
bool contains(T)(inout(void[0][T]) set, T key) {
return (key in set) !is null;
}
void main() {
Set!int set;
set.add(1);
assert(set.contain
On 04/01/2016 02:29 PM, Jonathan M Davis via Digitalmars-d wrote:
On Friday, April 01, 2016 15:52:49 matovitch via Digitalmars-d wrote:
Indeed, just wanted to point that out. (I guess that's why the
set was introduced before the unordered one in the c++ stl as
well). I feel like containers are a
On 2016-03-31 21:24, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind for a while.
Would that work ?
An alternative syntax for declaring a set could be:
[int] set;
Not sure if that conflicts with any existing syntax.
--
/Jacob Carlborg
On 2016-03-31 21:57, Walter Bright wrote:
On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote:
Ah, makes sense. But what would aa[x] return?
A bool indicating membership.
And how would you add elements to it?
aa[x] = true; // add member x
aa[x] = false; // remove member x
x in aa;
On Friday, April 01, 2016 15:52:49 matovitch via Digitalmars-d wrote:
> Indeed, just wanted to point that out. (I guess that's why the
> set was introduced before the unordered one in the c++ stl as
> well). I feel like containers are an old topic. Last time I asked
> I was told : wait for the allo
On Friday, 1 April 2016 at 15:45:13 UTC, Jack Stouffer wrote:
On Friday, 1 April 2016 at 12:57:12 UTC, matovitch wrote:
I don't know about the implementation of redblack tree in
phobos, but I am willing to bet on a large performance
drawback if you compare it against an optimized hash table
(f
On Friday, 1 April 2016 at 15:39:05 UTC, Jonathan M Davis wrote:
On Friday, April 01, 2016 12:57:12 matovitch via Digitalmars-d
wrote:
On Friday, 1 April 2016 at 12:45:23 UTC, Jonathan M Davis
wrote:
> As it stands, if someone wants a set with Phobos, we have
> RedBlackTree in std.container. So
On Thursday, 31 March 2016 at 19:24:14 UTC, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind for
a while. Would that work ?
We could do something similar as what's done with string and add
an `alias set(T) = void[T]`, then provide the necessary helper
functions suc
On Friday, 1 April 2016 at 12:57:12 UTC, matovitch wrote:
I don't know about the implementation of redblack tree in
phobos, but I am willing to bet on a large performance drawback
if you compare it against an optimized hash table (for example
using robin-hood open addressing techniques). And I
On Friday, April 01, 2016 12:57:12 matovitch via Digitalmars-d wrote:
> On Friday, 1 April 2016 at 12:45:23 UTC, Jonathan M Davis wrote:
> > As it stands, if someone wants a set with Phobos, we have
> > RedBlackTree in std.container. So, we actually have sets
> > already. But all of that will presu
On Friday, 1 April 2016 at 12:45:23 UTC, Jonathan M Davis wrote:
On Friday, April 01, 2016 19:26:46 Daniel Murphy via
Digitalmars-d wrote:
On 1/04/2016 6:24 AM, deadalnix wrote:
> Pretty much as per title. I has that in the back of my mind
> for a while. Would that work ?
Don't forget that bu
On Friday, April 01, 2016 19:26:46 Daniel Murphy via Digitalmars-d wrote:
> On 1/04/2016 6:24 AM, deadalnix wrote:
> > Pretty much as per title. I has that in the back of my mind for a while.
> > Would that work ?
>
> Don't forget that builtin AAs have been an epic disaster, and this would
> requir
On Friday, 1 April 2016 at 11:59:29 UTC, Dejan Lekic wrote:
On Thursday, 31 March 2016 at 19:24:14 UTC, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind
for a while. Would that work ?
I am not sure about that... I would rather have a completely
new type (`set`) for
On Fri, Apr 01, 2016 at 07:26:46PM +1100, Daniel Murphy via Digitalmars-d wrote:
> On 1/04/2016 6:24 AM, deadalnix wrote:
> >Pretty much as per title. I has that in the back of my mind for a
> >while. Would that work ?
>
> Don't forget that builtin AAs have been an epic disaster, and this
> would
On Thursday, 31 March 2016 at 19:24:14 UTC, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind for
a while. Would that work ?
I am not sure about that... I would rather have a completely new
type (`set`) for this purpose.
On Friday, 1 April 2016 at 08:52:40 UTC, Q. Schroll wrote:
The methods add and remove return bool values that indicate the
state being changed:
• addreturns true iff key has not been already present.
• remove returns true iff key has been already present.
Should have been
The methods
On Friday, 1 April 2016 at 09:55:58 UTC, cym13 wrote:
On Friday, 1 April 2016 at 08:52:40 UTC, Q. Schroll wrote:
[...]
I most of what is said here, assigning true or false makes for
an aweful API compared to add() and remove(). I agree with Adam
Ruppe that if we are to use AA-like syntax we
On Friday, 1 April 2016 at 08:52:40 UTC, Q. Schroll wrote:
[...]
I most of what is said here, assigning true or false makes for an
aweful API
compared to add() and remove(). I agree with Adam Ruppe that if
we are to use AA-like syntax we have to keep a coherent API.
Also, I don't like join
On Thursday, 31 March 2016 at 19:57:50 UTC, Walter Bright wrote:
aa[x] = true; // add member x
aa[x] = false; // remove member x
x in aa; // compile error
On Friday, 1 April 2016 at 02:36:35 UTC, Jonathan M Davis wrote:
Still, while it's true that aa.remove is how you'd normally do
it, I thin
On 1/04/2016 6:24 AM, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind for a while.
Would that work ?
Don't forget that builtin AAs have been an epic disaster, and this would
require an appalling amount of effort to implement in the compiler
types, ctfe, druntime,
On Thursday, 31 March 2016 at 20:51:53 UTC, Jack Stouffer wrote:
Wouldn't just be better to use a std.allocator backed set
container instead over special casing the AA syntax like this?
Syntactically, that makes more sense.
Or there's always ubyte[0][T].
On 3/31/2016 7:31 PM, Jonathan M Davis via Digitalmars-d wrote:
LOL. Except that as with everything, Murphy is at work. If it's something
that you want to be around forever, it probably won't be, but if it's
something that you don't want to be around, then it probably will be until
the end of tim
On Thursday, March 31, 2016 17:44:15 Steven Schveighoffer via Digitalmars-d
wrote:
> hm... I suppose:
>
> a[x] = void;
>
> could add. Removal is never done by assigning, only by aa.remove.
Well, from the standpoint of it being a map, you could argue that _every_
key is in the set. It's just that
On Thursday, March 31, 2016 14:45:18 Walter Bright via Digitalmars-d wrote:
> On 3/31/2016 2:09 PM, Ali Çehreli wrote:
> > Expanding on Walter's idea:
> >a[x] = shared(void);// add
> >a[x] = void;// remove
>
> For shame!
>
> > Ali
> > "ducks and runs for cover" :)
>
> The in
On 3/31/2016 2:09 PM, Ali Çehreli wrote:
Expanding on Walter's idea:
a[x] = shared(void);// add
a[x] = void;// remove
For shame!
Ali
"ducks and runs for cover" :)
The internet is forever :-)
On 3/31/16 5:09 PM, Ali Çehreli wrote:
On 03/31/2016 01:39 PM, Steven Schveighoffer wrote:
> But how do you add a key to the set? Currently only allowed via:
>
> a[x] = ...;
Expanding on Walter's idea:
a[x] = shared(void);// add
a[x] = void;// remove
Ali
"ducks and ru
On 3/31/2016 12:58 PM, H. S. Teoh via Digitalmars-d wrote:
How is this different from bool[T] then? Just the fact that you can't
get a reference to the bool?
Differences are:
1. it uses less storage, as the bool is implied
2. you cannot have a key in the set that has an associated value of fal
On Thursday, 31 March 2016 at 21:09:30 UTC, Ali Çehreli wrote:
Expanding on Walter's idea:
a[x] = shared(void);// add
a[x] = void;// remove
Ali
"ducks and runs for cover" :)
And shared(void)[T] declares an add-only set, right?
On Thursday, 31 March 2016 at 20:39:36 UTC, Steven Schveighoffer
wrote:
But how do you add a key to the set? Currently only allowed via:
a[x] = ...;
Oh yeah... when I use a built in AA as a set now, I either set it
to true or to itself:
string[string] lameSet;
lameSet[a] = a;
lameSet.remo
On Thu, Mar 31, 2016 at 02:09:30PM -0700, Ali Çehreli via Digitalmars-d wrote:
> On 03/31/2016 01:39 PM, Steven Schveighoffer wrote:
>
> > But how do you add a key to the set? Currently only allowed via:
> >
> > a[x] = ...;
>
> Expanding on Walter's idea:
>
> a[x] = shared(void);// add
>
On 03/31/2016 01:39 PM, Steven Schveighoffer wrote:
> But how do you add a key to the set? Currently only allowed via:
>
> a[x] = ...;
Expanding on Walter's idea:
a[x] = shared(void);// add
a[x] = void;// remove
Ali
"ducks and runs for cover" :)
On Thursday, 31 March 2016 at 19:24:14 UTC, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind for
a while. Would that work ?
Wouldn't just be better to use a std.allocator backed set
container instead over special casing the AA syntax like this?
On 3/31/16 4:11 PM, Adam D. Ruppe wrote:
On Thursday, 31 March 2016 at 19:57:50 UTC, Walter Bright wrote:
On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote:
Ah, makes sense. But what would aa[x] return?
A bool indicating membership.
Ewww. If it looks like an AA, let's at least keep
On Thursday, 31 March 2016 at 19:58:54 UTC, H. S. Teoh wrote:
How is this different from bool[T] then? Just the fact that you
can't get a reference to the bool?
void[T] could be more efficient, since it wouldn't need to
allocate memory for a bool payload. I expect that alignment
concerns typi
On Thursday, 31 March 2016 at 19:57:50 UTC, Walter Bright wrote:
On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote:
Ah, makes sense. But what would aa[x] return?
A bool indicating membership.
Ewww. If it looks like an AA, let's at least keep the AA
interface.
aa[x] returns void,
On Thu, Mar 31, 2016 at 12:57:50PM -0700, Walter Bright via Digitalmars-d wrote:
> On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote:
> >Ah, makes sense. But what would aa[x] return?
>
> A bool indicating membership.
>
> >And how would you add elements to it?
>
> aa[x] = true; // add m
On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote:
Ah, makes sense. But what would aa[x] return?
A bool indicating membership.
And how would you add elements to it?
aa[x] = true; // add member x
aa[x] = false; // remove member x
x in aa; // compile error
On Thu, Mar 31, 2016 at 09:39:53PM +0200, Jacob Carlborg via Digitalmars-d
wrote:
> On 2016-03-31 21:29, H. S. Teoh via Digitalmars-d wrote:
> >On Thu, Mar 31, 2016 at 07:24:14PM +, deadalnix via Digitalmars-d wrote:
> >>Pretty much as per title. I has that in the back of my mind for a
> >>whi
On Thursday, 31 March 2016 at 19:24:14 UTC, deadalnix wrote:
Pretty much as per title. I has that in the back of my mind for
a while. Would that work ?
I like this idea. I actually thought of it myself before, which
suggests that the syntax would be somewhat intuitive and
therefore easy to re
On 2016-03-31 21:29, H. S. Teoh via Digitalmars-d wrote:
On Thu, Mar 31, 2016 at 07:24:14PM +, deadalnix via Digitalmars-d wrote:
Pretty much as per title. I has that in the back of my mind for a
while. Would that work ?
What's a "builtin set of T"?
int[string] is a built-in associative
On Thursday, 31 March 2016 at 19:29:19 UTC, H. S. Teoh wrote:
On Thu, Mar 31, 2016 at 07:24:14PM +, deadalnix via
Digitalmars-d wrote:
Pretty much as per title. I has that in the back of my mind
for a while. Would that work ?
What's a "builtin set of T"?
T
https://en.wikipedia.org/wik
On Thu, Mar 31, 2016 at 07:24:14PM +, deadalnix via Digitalmars-d wrote:
> Pretty much as per title. I has that in the back of my mind for a
> while. Would that work ?
What's a "builtin set of T"?
T
--
Век живи - век учись. А дураком помрёшь.
Pretty much as per title. I has that in the back of my mind for a
while. Would that work ?
44 matches
Mail list logo