Thread overview | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 15, 2013 Look and think good things about D | ||||
---|---|---|---|---|
| ||||
I have created two interesting D entries for this Rosettacode Task, is someone willing to create a Reddit entry for this? They show very different kinds of code in D. http://rosettacode.org/wiki/Look-and-say_sequence#D Bye, bearophile |
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 15 November 2013 at 01:09:53 UTC, bearophile wrote: > I have created two interesting D entries for this Rosettacode Task, is someone willing to create a Reddit entry for this? They show very different kinds of code in D. > > http://rosettacode.org/wiki/Look-and-say_sequence#D > > Bye, > bearophile >> Using the LDC2 compiler with n=70 the run-time is about 3.74 seconds. Timings for short functional version vs fast would be nice. --rt |
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 11/15/2013 02:09 AM, bearophile wrote:
> I have created two interesting D entries for this Rosettacode Task
len.uninitializedArray ? Isn't this too much UFCS?
|
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob T | Rob T: > Timings for short functional version vs fast would be nice. OK. On the other hand regarding speed the fast version is in another world. So the speed comparison will become a little silly. -------------- Martin Nowak: > len.uninitializedArray ? Isn't this too much UFCS? I think it's just enough of UFCS. Bye, bearophile |
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | > OK. On the other hand regarding speed the fast version is in another world. So the speed comparison will become a little silly.
The first program doesn't even compile with ldc2 v.2.063.2, and the two programs are quite different in scope...
Bye,
bearophile
|
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob T | Rob T:
> Timings for short functional version vs fast would be nice.
Below the two I have added a note to compare the run-times.
Bye,
bearophile
|
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 15 November 2013 at 01:09:53 UTC, bearophile wrote:
> I have created two interesting D entries for this Rosettacode Task, is someone willing to create a Reddit entry for this? They show very different kinds of code in D.
>
> http://rosettacode.org/wiki/Look-and-say_sequence#D
>
> Bye,
> bearophile
I didn't look that closely at the imperative code, but it seems to be quite a bit longer than most of the other imperative examples. Is this because it's super-optimized?
|
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | Meta:
> I didn't look that closely at the imperative code, but it seems to be quite a bit longer than most of the other imperative examples. Is this because it's super-optimized?
Yes, it's longer because it's optimized.
Bye,
bearophile
|
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 15 November 2013 at 01:09:53 UTC, bearophile wrote:
> I have created two interesting D entries for this Rosettacode Task, is someone willing to create a Reddit entry for this? They show very different kinds of code in D.
>
> http://rosettacode.org/wiki/Look-and-say_sequence#D
The fast version is nearly functional, too. Since memory management is not considered a side effect there is only the printfs. If the printfs are wrapped into "debug", the function is pure.
|
November 15, 2013 Re: Look and think good things about D | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 2013-11-15 02:09, bearophile wrote: > I have created two interesting D entries for this Rosettacode Task, is > someone willing to create a Reddit entry for this? They show very > different kinds of code in D. > > http://rosettacode.org/wiki/Look-and-say_sequence#D What does this show, that ranges is slow in D? -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation