From: <sur...@ya...> - 2004-09-12 10:49:01
|
--- Pierre Etchemaite <pet...@co...> ha scritto: > Just a word about the lists test > (see > http://concept.free.free.fr/scutigena/tests/ocaml/common/src/lists.ml) > > ocaml native lists are classical functionnal lists, > so implementing the test > as-is with them would lead to quadratic complexity. > I think any ocaml > programmer would know that, so coding it that way > would be absolutely > articifial (Maybe I should implement it just for the > sake of the test :j) This is true for every test,I'm afraid. Probably neither a perlist or a pythonista or a rubyist would compute fibonacci numbers recursively, neither they would use an hand written rand() in the heapsort case. But the comparison is based on languages doing the same thing so maybe you really need to do it for the sake of the test ;) > In real life, faced to a similar problem, one would > probably try > to avoid building all the intermediate lists (but > test description requires > it), or use reverted lists so that operations can be > done efficiently from > head side of lists (but since the whole exercice is > about reverting lists, > the code would look very silly if that trick was > used... Uh, just noticed > the MzScheme code seems to do that ;) ), or use > another data structure. > > Arrays would have been an option, but it's not very > adapted either, unless > you size the arrays correctly from the beginning > (but code wouldn't stick > closely enough to the test description in my > opinion). > > So I used my own functionnal datastructure, > encapsulated in a module. > I hope you like it ;) > > BR, > Pierre. > > P.S. I'm not subscribed to the list. > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. > Be one of 170 > Project Admins to receive an Apple iPod Mini FREE > for your judgement on > who ports your project to Linux PPC the best. > Sponsored by IBM. > Deadline: Sept. 13. Go here: > http://sf.net/ppc_contest.php > _______________________________________________ > Scutigena-code mailing list > Scu...@li... > https://lists.sourceforge.net/lists/listinfo/scutigena-code > ===== icq #69488917 ___________________________________ Scopri Mister Yahoo! - il fantatorneo sul calcio di Yahoo! Sport http://it.seriea.fantasysports.yahoo.com/ |