From: Pierre E. <pet...@co...> - 2004-09-12 03:25:05
|
Hi, I wrote tests for the ocaml compiler. If you're in a hurry, sources are here: http://concept.free.free.fr/scutigena/scutigena-ocaml.tgz 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) 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. |