Thread overview
Fw: Rosetta Code seeks programming examples
Jan 18, 2008
BCS
Jan 18, 2008
bearophile
Jan 18, 2008
BCS
Jan 22, 2008
badmadevil
Jan 25, 2008
naryl
January 18, 2008
Michael posted

> I run a website called Rosetta Code, where the general idea is to
> demonstrate how to do similar things in as many programming languages
> as possible.  Solutions in different languages are shown side-by-side,
> to allow comparisons to be drawn to people familiar with one language,
> but unfamiliar with another.
> 
> At the time of this writing, there are 16 examples written in D, out
> of 121 established tasks. That's only 13%.
> 
> The main website url is http://rosettacode.org
> 
> You might find these pages interesting as well:
> http://rosettacode.org/rosettacode/w/index.php?title=Category:Solution
> s_by_Programming_Task
> http://rosettacode.org/rosettacode/w/index.php?title=Category:Solution
> s_by_Programming_Language
> 


January 18, 2008
BCS:
> > At the time of this writing, there are 16 examples written in D, out of 121 established tasks. That's only 13%.

And most of them are from me, I presume.
There is the codecodex.com site too, and it looks more interesting than the rosettacode site, I have written D & Python code for both sites:
http://www.codecodex.com/wiki/index.php?title=Main_Page

At the moment the codecodex.com site doesn't have a category for D, despite I have added many D implementations, some examples:
http://www.codecodex.com/wiki/index.php?title=Convert_text_to_Morse_Code
http://www.codecodex.com/wiki/index.php?title=Selection_sort
http://www.codecodex.com/wiki/index.php?title=Shell_sort

I think such sites, like the Shootout, are good to make a language more known. I think the Haskell community takes them "seriously" enough.

Bye,
bearophile
January 18, 2008
>At the time of this writing, there are 16 examples written in D, out
>of 121 established tasks. That's only 13%.

looking at the page, one jumped out at me, "Greatest common divisor". I, just last night, did that one as a template as part of some compile time work with rational numbers. I wonder what "programming language" heading that would fall under
January 22, 2008
bearophile wrote:
> BCS:
>>> At the time of this writing, there are 16 examples written in D, out
>>> of 121 established tasks. That's only 13%.
> 
> And most of them are from me, I presume.
> There is the codecodex.com site too, and it looks more interesting than the rosettacode site, I have written D & Python code for both sites:
> http://www.codecodex.com/wiki/index.php?title=Main_Page
> 
> At the moment the codecodex.com site doesn't have a category for D, despite I have added many D implementations, some examples:
> http://www.codecodex.com/wiki/index.php?title=Convert_text_to_Morse_Code
> http://www.codecodex.com/wiki/index.php?title=Selection_sort
> http://www.codecodex.com/wiki/index.php?title=Shell_sort
> 
> I think such sites, like the Shootout, are good to make a language more known. I think the Haskell community takes them "seriously" enough.
> 
> Bye,
> bearophile

Hi, I'm just a noob ^^

I don't know who coded the D version of Arithmetic Evaluator.
I think it has bug.

http://rosettacode.org/rosettacode/w/index.php?title=Arithmetic_Evaluator
test:
  writefln(calculate("(3+50)*7-9"), ", ", (3+50)*7-9);
  writefln(calculate("(3+50)*7-9-1"), ", ", (3+50)*7-9-1);
  writefln(calculate("1+2"), ", ", 1+2);
  writefln(calculate("1+2+3"), ", ", 1+2+3);
  writefln(calculate("1+2+3+4"), ", ", 1+2+3+4);
  writefln(calculate("1+2+3+4+5"), ", ", 1+2+3+4+5);
  writefln(calculate("1+2+3+4+5+6"), ", ", 1+2+3+4+5+6);
  writefln(calculate("1+2+3+4+5+6+7"), ", ", 1+2+3+4+5+6+7);
output:
362, 362
362, 361
3, 3
3, 6
7, 10
7, 15
13, 21
13, 28

peace~
January 25, 2008
badmadevil Wrote:
> I don't know who coded the D version of Arithmetic Evaluator. I think it has bug.

Looks like the current solution does something wrong with precedence and calculates addition and subtraction right to left... and then again left to right.

"(3+50)*7-9-1" is calculated like (3+50)*7-(9-1)-1