Re: relative benefit of .reserve and .length

2016-04-29 Thread Jay Norwood via Digitalmars-d-learn
On Friday, 29 April 2016 at 10:10:26 UTC, sigod wrote: How about `assumeSafeAppend`? Does it have any positive impact on performance? assumeSafeAppend made it even slower ... about 20x instead of 10x worse than the indexed assign. Release build, win32.

Re: Print a triangle

2016-04-29 Thread Joel via Digitalmars-d-learn
[snip] On Friday, 29 April 2016 at 13:20:47 UTC, Michael Coulombe wrote: Try this: iota(1,11).each!(a => writeln("#".replicate(a))) Yes, this is what I was looking for! It's my birthday today.

Re: D GUI Toolkit Comparison

2016-04-29 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 29 April 2016 at 13:52:59 UTC, Nordlöw wrote: Could somebody briefly outline the different GUI toolkits available in D and how they differ especially in terms of cleverly the make use of all idioms available in the language aswell as in Phobos. For instance: DlangUI and Adams D Rup

Re: Print a triangle

2016-04-29 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 29, 2016 at 11:45:39AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: [...] > Unfortunately, due to some silly autodecoding issues in Phobos, > byCodeUnit is a necessary hack to make this work. I'll file a bug for > this. [...] https://issues.dlang.org/show_bug.cgi?id=15972 T --

Re: Print a triangle

2016-04-29 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 29, 2016 at 12:01:19PM +, Joel via Digitalmars-d-learn wrote: > On Friday, 29 April 2016 at 11:31:51 UTC, rikki cattermole wrote: > >Not entirely the goal I'm guessing output wise, but this works. > > > >import std.range : repeat; > >foreach(line; 1 .. 11) { > > writeln('#'.repe

Re: D GUI Toolkit Comparison

2016-04-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 29 April 2016 at 13:52:59 UTC, Nordlöw wrote: Could somebody briefly outline the different GUI toolkits available in D and how they differ especially in terms of cleverly the make use of all idioms available in the language aswell as in Phobos. For instance: DlangUI and Adams D Rup

D GUI Toolkit Comparison

2016-04-29 Thread Nordlöw via Digitalmars-d-learn
Could somebody briefly outline the different GUI toolkits available in D and how they differ especially in terms of cleverly the make use of all idioms available in the language aswell as in Phobos. For instance: DlangUI and Adams D Ruppe's `simpledisplay`

Re: Print a triangle

2016-04-29 Thread Michael Coulombe via Digitalmars-d-learn
On Friday, 29 April 2016 at 12:01:19 UTC, Joel wrote: On Friday, 29 April 2016 at 11:31:51 UTC, rikki cattermole wrote: Not entirely the goal I'm guessing output wise, but this works. import std.range : repeat; foreach(line; 1 .. 11) { writeln('#'.repeat(line)); } That is shorter than

Re: C header file: tagged enumerations

2016-04-29 Thread Kagamin via Digitalmars-d-learn
On Thursday, 28 April 2016 at 22:54:10 UTC, Jesse Phillips wrote: This one doesn't get the values right for the different versions. The other problem is functions are written as: void* something(INSTALLMESSAGE arg); So I could make all the functions take an int/uint or such, but that is a

Re: Print a triangle

2016-04-29 Thread Joel via Digitalmars-d-learn
On Friday, 29 April 2016 at 11:31:51 UTC, rikki cattermole wrote: Not entirely the goal I'm guessing output wise, but this works. import std.range : repeat; foreach(line; 1 .. 11) { writeln('#'.repeat(line)); } That is shorter than my foreach version, but I want one that doesn't use f

Re: Print a triangle

2016-04-29 Thread rikki cattermole via Digitalmars-d-learn
On 29/04/2016 11:23 PM, Joel wrote: What is a quick way to print a triangle? I'm thinking without foreach, not like I have here. foreach(line; iota(1, 10 + 1)) { writeln("#".replicate(line)); } These don't work: iota(1, 10 + 1). tee!((a) => { writeln("#".replicate(a)); }); string result;

Print a triangle

2016-04-29 Thread Joel via Digitalmars-d-learn
What is a quick way to print a triangle? I'm thinking without foreach, not like I have here. foreach(line; iota(1, 10 + 1)) { writeln("#".replicate(line)); } These don't work: iota(1, 10 + 1). tee!((a) => { writeln("#".replicate(a)); }); string result; iota(1, 10 + 1). tee!((a) => res

Re: relative benefit of .reserve and .length

2016-04-29 Thread sigod via Digitalmars-d-learn
On Thursday, 28 April 2016 at 14:08:26 UTC, Steven Schveighoffer wrote: On 4/28/16 8:56 AM, Jay Norwood wrote: [...] .reserve should make an improvement for large amount of appending, since you pre-allocate the data. [...] How about `assumeSafeAppend`? Does it have any positive impact on

std.signals Can not connect a delegate without in Object

2016-04-29 Thread Dsby via Digitalmars-d-learn
import std.signals; import std.stdio; class hh { mixin Signal!(); void haha(){emit();} } class ff { void show() { writeln("ff show"); } } void main() { auto h = new hh(); void show() { writeln("main show"); } auto f = new ff();