Re: Complex networks in D

2013-07-16 Thread Walter Bright
On 7/15/2013 2:32 PM, Joseph Rushton Wakeling wrote: Following the discussion on digitalmars.D, I've put together a little (... er, long ...) blog post discussing the basics of my D graph library: http://braingam.es/2013/07/complex-networks-in-d/ The main slant of this post is the ease

Re: Complex networks in D

2013-07-16 Thread Paulo Pinto
/complex-networks-in-d/ The main slant of this post is the ease of writing this stuff in D. Later posts will follow up on performance issues and fill in some more detail about the workings of the library. {Enj,Destr}oy :-) https://news.ycombinator.com/item?id=6050404 http://www.reddit.com/r

Re: Complex networks in D

2013-07-16 Thread Joseph Rushton Wakeling
On Tuesday, 16 July 2013 at 08:27:07 UTC, Paulo Pinto wrote: On Tuesday, 16 July 2013 at 07:17:59 UTC, Walter Bright wrote: https://news.ycombinator.com/item?id=6050404 http://www.reddit.com/r/programming/comments/1iegj9/complex_networks_in_d/ Thanks! :-)

Re: Complex networks in D

2013-07-16 Thread bearophile
Joseph Rushton Wakeling: http://braingam.es/2013/07/complex-networks-in-d/ size_t vertexCount() @property const pure nothrow { assert(_sumHead.length == _sumTail.length); return _sumHead.length - 1; } Is that better written in a struct/class invariant

Re: Complex networks in D

2013-07-16 Thread Joseph Rushton Wakeling
On Tuesday, 16 July 2013 at 14:18:02 UTC, bearophile wrote: size_t vertexCount() @property const pure nothrow { assert(_sumHead.length == _sumTail.length); return _sumHead.length - 1; } Is that better written in a struct/class invariant? Nice thought -- probably;

Re: Complex networks in D

2013-07-16 Thread bearophile
Joseph Rushton Wakeling: It wasn't clear to me what the benefits were, though, For this function not a lot, but it's a good habit to have. especially as I did consider making this an enforce() rather than an assert(). If you want to use enforce then don't put them in pre-conditions. But

Re: Complex networks in D

2013-07-16 Thread Walter Bright
On 7/16/2013 2:27 AM, Joseph Rushton Wakeling wrote: On Tuesday, 16 July 2013 at 08:27:07 UTC, Paulo Pinto wrote: On Tuesday, 16 July 2013 at 07:17:59 UTC, Walter Bright wrote: https://news.ycombinator.com/item?id=6050404

Re: Complex networks in D

2013-07-16 Thread Joseph Rushton Wakeling
On Tuesday, 16 July 2013 at 18:22:31 UTC, Walter Bright wrote: People are much more likely to read your article from links in reddit and hackernews if you put in as a comment some description of it. Don't wait for others to do it for you! They may mischaracterize it, or worse, the opportunity

Re: Complex networks in D

2013-07-16 Thread Joseph Rushton Wakeling
On Tuesday, 16 July 2013 at 15:57:06 UTC, bearophile wrote: For such kind of code I suggest to use UFCS chains. Can you explain in a little more detail? It's not an aspect of programming I'm familiar with. auto r1 = iota(_sumHead[v], _sumHead[v + 1]).map!(a = _tail[_indexHead[a]]); auto

Re: Complex networks in D

2013-07-16 Thread bearophile
Joseph Rushton Wakeling: To be sure I understand what you're getting at, is it just that it's more elegant to write it this way (I agree:-), or is there a performance benefit in the iota().map!() form (or to separately generating the ranges and then chaining them)? It's just more readable.

Complex networks in D

2013-07-15 Thread Joseph Rushton Wakeling
Following the discussion on digitalmars.D, I've put together a little (... er, long ...) blog post discussing the basics of my D graph library: http://braingam.es/2013/07/complex-networks-in-d/ The main slant of this post is the ease of writing this stuff in D. Later posts will follow up