October 13, 2006
"Don Clugston" <dac@nospam.com.au> wrote in message news:egoc9c$lfm$1@digitaldaemon.com...
> Lionello Lunesu wrote:
>> While trying to understand the c++ implementation, I found out what the problem was. The c++ version does not allow a digit at position k if there's a word in the dictionary that matches the digits at k..n, even if that word cannot actually be used in the encoding because of a mismatch anywhere after n.
>>
>> For example 30694, there IS a word matching "306", "sei" and therefor, the result "3-/0--69-4: 3 echt" is not considered..
>>
>> L.
>
> So the C++ version wasn't merely more complicated and slower than D, it was also wrong??

I would say: yes :)

But, I don't really know what's right and what's wrong, since the description could be interpreted either way. I'd say the way the C++ version is doing it makes no sense logically.. The fact that there's a word "sei" in the dictionary should not prevent a good result "3 echt" from being considered.

L.


October 13, 2006
Lionello Lunesu wrote:
> But, I don't really know what's right and what's wrong, since the description could be interpreted either way. I'd say the way the C++ version is doing it makes no sense logically.. The fact that there's a word "sei" in the dictionary should not prevent a good result "3 echt" from being considered.

Could you put together a web page with the results? Or just text, I can turn it into a web page.
October 16, 2006
Walter Bright wrote:
> Lionello Lunesu wrote:
>> But, I don't really know what's right and what's wrong, since the description could be interpreted either way. I'd say the way the C++ version is doing it makes no sense logically.. The fact that there's a word "sei" in the dictionary should not prevent a good result "3 echt" from being considered.
> 
> Could you put together a web page with the results? Or just text, I can turn it into a web page.

Sure thing!
October 16, 2006
clayasaurus wrote:
> Walter Bright wrote:
>> Sean Kelly wrote:
>>> I believe that D has a definite opportunity to do better than C++ in code clarity and ease of programming, but I'm not sure the library is sufficient quiet yet.  The C++ algorithm/iterator model is extremely powerful and D's foreach and delegates aren't enough by themselves.  For example, writing the code snippet above in D would be much more like the original C++ version than my rewrite.  For D to be great, I think it will need an standard algorithm-oriented library that exploits D's unique language features.  DTL seemed a likely candidate, but development on it stalled ages ago.  But perhaps it contains ideas worth pursuing.  I'll admit it's been so long that I've forgotten a lot of the details of how it works.
>>
>> D just needs a foreach_reverse statement.
> 
> old thread on the subject: http://www.digitalmars.com/d/archives/digitalmars/D/17320.html

Thanks Clay.  I was about to post an "I told you so..." post, but you saved us all from that fate.

Wait...

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M--@ V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++
------END GEEK CODE BLOCK------

James Dunne
October 17, 2006
clayasaurus wrote:
> Walter Bright wrote:
>> Sean Kelly wrote:
>>> I believe that D has a definite opportunity to do better than C++ in code clarity and ease of programming, but I'm not sure the library is sufficient quiet yet.  The C++ algorithm/iterator model is extremely powerful and D's foreach and delegates aren't enough by themselves.  For example, writing the code snippet above in D would be much more like the original C++ version than my rewrite.  For D to be great, I think it will need an standard algorithm-oriented library that exploits D's unique language features.  DTL seemed a likely candidate, but development on it stalled ages ago.  But perhaps it contains ideas worth pursuing.  I'll admit it's been so long that I've forgotten a lot of the details of how it works.
>>
>> D just needs a foreach_reverse statement.
> 
> old thread on the subject: http://www.digitalmars.com/d/archives/digitalmars/D/17320.html

I know, lots of good ideas in that thread. I was hoping to find a way to do it using existing language facilities, but the results are just too hackish.
October 19, 2006
> Could you put together a web page with the results? Or just text, I can turn it into a web page.

Here it is!

Feel free to check my english and fix it :)

L.



October 20, 2006
Lionello Lunesu wrote:
>> Could you put together a web page with the results? Or just text, I can
>> turn it into a web page.
> 
> Here it is!
> 
> Feel free to check my english and fix it :)

Cool!
October 20, 2006
I've taken the liberty of:

1) Converting it to use Ddoc and the macros used to create the Digital Mars site.
2) Added a link to this thread.
3) Took out the bit about compiling html, as I need to fix Ddoc so that works!
4) Hosting it.

If you object to any of this, or have any corrections, please let me know and I'll take care of it!

http://www.digitalmars.com/d/lisp-java-d.html

If it meets with your approval, I'll add it to the 'Comparisons' links.

Thanks!
October 20, 2006
"Walter Bright" <newshound@digitalmars.com> wrote in message news:eh9fib$ve9$1@digitaldaemon.com...
> I've taken the liberty of:
>
> 1) Converting it to use Ddoc and the macros used to create the Digital
> Mars site.
> 2) Added a link to this thread.
> 3) Took out the bit about compiling html, as I need to fix Ddoc so that
> works!
> 4) Hosting it.
>
> If you object to any of this, or have any corrections, please let me know and I'll take care of it!
>
> http://www.digitalmars.com/d/lisp-java-d.html
>
> If it meets with your approval, I'll add it to the 'Comparisons' links.

Of couse, I'd be honoured! :)

> Thanks!

No, thank you! ; )

L.

PS. I don't like the way the longer lines of code exceed the code-box. I had the same thing and fixed it using 'margin' instead of 'width' in the style sheet. Might work?


October 20, 2006
Lionello Lunesu wrote:
> Of couse, I'd be honoured! :)

Ok!

> PS. I don't like the way the longer lines of code exceed the code-box. I had the same thing and fixed it using 'margin' instead of 'width' in the style sheet. Might work? 

I think it looks fine.