Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 04, 2013 A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Is the Fwend user of Rosettacode (or some other interested person) around here? I have written partial D implementations for three tasks, maybe a little of coordination will speedup the work: http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation http://rosettacode.org/wiki/Universal_Turing_machine http://rosettacode.org/wiki/RCRPG Bye, bearophile |
February 05, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 5-2-2013 0:55, bearophile wrote: > Is the Fwend user of Rosettacode (or some other interested person) around here? I have written partial D implementations >for three tasks, maybe a little of coordination will speedup the work: > > http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation > http://rosettacode.org/wiki/Universal_Turing_machine > http://rosettacode.org/wiki/RCRPG I'll give it a shot if you like. The RCRPG I'd like to try first. By the way, I think 'Qznc' may want to have a look at 'The dining philosophers': http://rosettacode.org/wiki/Dining_philosophers |
February 05, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jos van Uden | Jos van Uden: > I'll give it a shot if you like. The RCRPG I'd like to try first. I have already partially written those: Partial translation of rcrpg-Python: http://codepad.org/SflrKqbT Partial translation of permutations_rank_of_a_permutation-Python: http://codepad.org/El9SQwOE Plus a better Perl implementation of the uniform() on BigInts: http://codepad.org/LGcMpk2f Partial translation of the universal_turing_machine-Ruby: http://codepad.org/nUXLzAg2 Bye, bearophile |
February 05, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 5-2-2013 21:10, bearophile wrote: How do we avoid working on the same thing? > Partial translation of rcrpg-Python: > http://codepad.org/SflrKqbT > > Partial translation of permutations_rank_of_a_permutation-Python: > http://codepad.org/El9SQwOE The 2 above, I could try. > Plus a better Perl implementation of the uniform() on BigInts: > http://codepad.org/LGcMpk2f My perl is too rusty. > Partial translation of the universal_turing_machine-Ruby: > http://codepad.org/nUXLzAg2 I'd have to first read up on the subject. > Bye, > bearophile |
February 05, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jos van Uden | Jos van Uden: > How do we avoid working on the same thing? With a little coordination :-) >> Partial translation of rcrpg-Python: >> http://codepad.org/SflrKqbT >> >> Partial translation of permutations_rank_of_a_permutation-Python: >> http://codepad.org/El9SQwOE > > The 2 above, I could try. > >> Plus a better Perl implementation of the uniform() on BigInts: >> http://codepad.org/LGcMpk2f > > My perl is too rusty. That perl is meant as a part of permutations_rank_of_a_permutation. Feel free to search for other good algorithms to implement uniform(BigInt,BigInt) much better than me. If this code comes out good enough, it must be added to Phobos (and it's meant to be designed better than the Java uniform generator for its bigintegers, because it doesn't give a correct range). >> Partial translation of the universal_turing_machine-Ruby: >> http://codepad.org/nUXLzAg2 > > I'd have to first read up on the subject. It's a simple task, just to implement an universal Turing machine. It's a matter of finding a balance between the too much high level Ruby version and a too much C-like version. In D a simple way to implement a tape is with two dynamic arrays, one represents all the cells on the right to the starting position, and the other array is used "inverted", to represent all the cells on the left of the right position. There are faster solutions, but this is enough for the purposes of Rosettacode. Bye, bearophile |
February 09, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Tuesday, 5 February 2013 at 20:10:37 UTC, bearophile wrote:
> Jos van Uden:
>
>> I'll give it a shot if you like. The RCRPG I'd like to try first.
>
> I have already partially written those:
>
> Partial translation of rcrpg-Python:
> http://codepad.org/SflrKqbT
>
> Partial translation of permutations_rank_of_a_permutation-Python:
> http://codepad.org/El9SQwOE
> Plus a better Perl implementation of the uniform() on BigInts:
> http://codepad.org/LGcMpk2f
>
> Partial translation of the universal_turing_machine-Ruby:
> http://codepad.org/nUXLzAg2
>
> Bye,
> bearophile
codepad.org doesn't work at all here. Maybe you should use dpaste (or pastebin for other languages) instead ?
|
February 10, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On 9-2-2013 23:14, SomeDude wrote:
> codepad.org doesn't work at all here. Maybe you should use dpaste (or pastebin for other languages) instead ?
It's not working for me either. It's probably a temporary problem. It worked fine before.
|
February 10, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | SomeDude: ... >> Partial translation of rcrpg-Python: >> http://codepad.org/SflrKqbT >> >> Partial translation of permutations_rank_of_a_permutation-Python: >> http://codepad.org/El9SQwOE >> Plus a better Perl implementation of the uniform() on BigInts: >> http://codepad.org/LGcMpk2f >> >> Partial translation of the universal_turing_machine-Ruby: >> http://codepad.org/nUXLzAg2 >> >> Bye, >> bearophile > > codepad.org doesn't work at all here. Maybe you should use dpaste (or pastebin for other languages) instead ? Links in the same order: http://dpaste.dzfl.pl/10eff346 http://dpaste.dzfl.pl/bfde8010 http://dpaste.dzfl.pl/3a172308 http://dpaste.dzfl.pl/22b7a931 Bye, bearophile |
February 12, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 10-2-2013 1:57, bearophile wrote: > ... >>> Partial translation of rcrpg-Python: >>> http://codepad.org/SflrKqbT I have the rcrpg working, but I want to test it some more. I'm not very happy with the alias function, it accepts just about any input, it can put the program in an invalid state. There was a bug by the way in the Python code, that slowed me down a bit. As for the "getattr", I've hacked a CTFE loop together that writes out if statements. I'm not sure how robust it is. We can always go for a handwritten "if else" or switch block. http://dpaste.dzfl.pl/5e6b824e |
February 12, 2013 Re: A little of coordination for Rosettacode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jos van Uden | Jos van Uden: > I have the rcrpg working, but I want to test it some more. Good. Adding a bit of unittesting is acceptable, I think. > I'm not very happy > with the alias function, it accepts just about any input, it can put the program in an invalid state. I presume this is a design bug shared with the original Python code. You have also fixed a translation bug of mine with remove(). I don't like that function. In past I did another mistake (in another program), forgetting to assign its result back to the array. > There was a bug by the way in the Python code, that slowed me down a bit. D static type system asks for more coding work, but it has caught very quickly that bug of this line of Python code: tokens[0] = aliases[tokens[0]] Dynamic typing has some advantages and in some cases it's handy, but it has some disadvantages too. On the other hand I think that Python code was not well tested; Python unittesting is able to catch most of similar bugs. I think we should fix the Python entry too (or at least add a note in the Talk page). > As for the "getattr", I've hacked a CTFE loop together that writes out if statements. I'm not sure how robust it is. I think in normal D code you don't catch Throwable, but maybe in this case it's OK. > http://dpaste.dzfl.pl/5e6b824e The D code has lot of imports because Python has a ton of built-in things. I have shortened the lines to about 72 chars max, and reformatted the code a bit. If you like it and you have a Rosettacode account, you can put it there yourself (otherwise I'll do it myself). If later you find bugs or you want to change something, there's always the possibility to modify it on the site. http://dpaste.dzfl.pl/6778053f In practice at the moment I am maintaining all the D entries of Rosettacode. I keep the coding style uniform, but sometimes I change some parts of such style on purpose to show different ways to use D, or specific things. Several Rosettacode solutions have more than one D entry, like when there is a very short and high-level entry and a longer and low level entry that's faster. Bye, bearophile |
Copyright © 1999-2021 by the D Language Foundation