|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
ANN: Libraries in MLton's library repositorySome people on this list are probably already aware of the fact
MLton's repository has a directory for libraries called mltonlib. Here is a link to a mail describing the project: http://mlton.org/pipermail/mlton/2006-December/029464.html Despite the fact that it is called "mltonlib", many of the libraries (developed by me) have been ported to other SML implementations including MLKit, Poly/ML, and SML/NJ. So, I would like to announce the availability of several libraries for SML/NJ: * Asynchronous Programming Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/com/ssh/async/unstable/README * Extended Basis Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/com/ssh/extended-basis/unstable/README * Generic Programming Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/com/ssh/generic/unstable/README * Pretty Printing Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/com/ssh/prettier/unstable/README * Random Generator Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/com/ssh/random/unstable/README * Unit Testing Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/com/ssh/unit-test/unstable/README * Use Library: http://mlton.org/cgi-bin/viewsvn.cgi/*checkout*/mltonlib/trunk/org/mlton/vesak/use-lib/unstable/README To check out the mltonlib repository, you can use the following command: svn co svn://mlton.org/mltonlib/trunk mltonlib If you have any trouble using the libraries, drop me a note (preferably on some SML related mailing list that I subscribe). Now, how do I get you to actually look at the libraries... If there exists a 11-line program that just makes you want to look, then maybe it is the below example from my slides at the ML workshop (http://research.microsoft.com/~crusso/ml2007/slides/ml08rp-karvonen-slides.pdf): CM.make "com/ssh/unit-test/unstable/lib-with-default.cm" ; CM.make "com/ssh/extended-basis/unstable/basis.cm" ; let open Generic UnitTest TopLevel in unitTests (title "Reverse (incorrect)") (testAll (sq (list int)) (fn (xs, ys) => thatEq (list int) {expect = rev (xs @ ys), actual = rev xs @ rev ys})) $ end ; The above is an example using the Unit Testing library. You can read the above test as follows: Test for all pairs of lists of integers xs and ys, that the lists of integers expect and actual are equal, where the expect list is the reverse of the concatenation of xs and ys and the actual list is the concatenation of the reverse of xs and the reverse of ys. Of course, this property does not hold. Running the above just now with SML/NJ gave me: [...] 1. Reverse (incorrect) test FAILED: with ([~2], [~1]) equality test failed: expected [~1, ~2], but got [~2, ~1]. What the output means is that the test failed with the counterexample ([~2], [~1]) and the reason why it failed is that the expect list [~1, ~2] wasn't equal to the actual list [~2, ~1]. It is easy to see that in order to implement this behavior, you need at least to be able to generate lists of integers, compare them for equality, and pretty print them. That's not all, however. It is not just a lucky coincidence that the lists in the counterexample were singleton lists and that the elements of the lists were numerically small. In fact, the current implementation makes use of a total of 9 generic utility operations: - The Arbitrary generic is used to generate random values while searching for a counterexample. - The Shrink generic is used to reduce the size of counterexamples to make them more readable. - The Size generic is used to order counterexamples by size and the Ord generic is used to order counterexamples by a linear ordering while shrinking counterexamples. - The Eq generic is used to compare values for equality. - The Pretty generic is used to pretty print values. - The Hash generic is used to hash values and is used internally by several other generics. - The TypeHash and TypeInfo generics are also used internally by other generics. These, and several other, generic functions are provided by the Generic Programming library and the Unit Testing library uses them. Have fun! -Vesa Karvonen ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Smlnj-list mailing list Smlnj-list@... https://lists.sourceforge.net/lists/listinfo/smlnj-list |
| Free Forum Powered by Nabble | Forum Help |