Hello
Here is the latest OCaml Weekly News, for the week of February 06 to 13, 2018.
Archive: https://discuss.ocaml.org/t/catching-type-error-in-toplevel/1538/1
Weng Shiwei asked:I am working on a grading script to grade students' submission. The general idea currently is loading a submission file in toplevel and running testcases on many functions in that submission file. I choose toplevel is due to some functions in submission may have type error. Saying one function in submission accepts only one argument but in fact it needs two arguments. If I try compiling the submission together with grading code, type error will stop the whole compiling. However, if I run it in toplevel, only this testcases fail, and the following testcases can still run, which may give them partial credits. This is the background. My questions is: - 1. Is it possible to catch type error in toplevel? If I could this, I can give better feedback - 2. Could some test framework like OUnit help? I admit using toplevel is somewhat hacking. The tricky part is I have to be enough tolerable to submission files.Gabriel Radanne replied:
You might want to look at the work done for the OCaml MOOC: - ICFP [paper](https://dl.acm.org/ft_gateway.cfm?id=3110248&ftid=1902061&dwn=1&CFID=5521532&CFTOKEN=75e77e9352adafe6-3CA9280E-FBD1-3243-FB03B2D0A9C845A7) and [video](https://www.youtube.com/watch?v=eVGvDqA_3u8) - Hosted version and sources: https://try.ocamlpro.com/fun-demo/ They do precisely what you describe (and quite a bit more, in fact).
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2018-02/msg00013.html
Francois BERENGER announced:A bisector tree allows to do fast but exact nearest neighbor searches in any space provided that you have a metric (function) to measure the distance between any two points in that space. It also allows proximity queries, as in "all points within distance d from my query point". Cf. this article for details: "A Data Structure and an Algorithm for the Nearest Point Problem"; Iraj Kalaranti and Gerard McDonald. ieeexplore.ieee.org/iel5/32/35936/01703102.pdf The code is here: https://github.com/UnixJunkie/bisec-tree It might interest users of vantage point trees (minivpt, and vpt in opam), kd-trees and such. I think bst should be faster than vpt in most use cases. It should appear in opam shortly.
Archive: https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535/4
Anton Bachin continued this thread:For completeness, there is also [Markup.ml](https://github.com/aantron/markup.ml). It is focused on HTML5, but it also includes an XML parser with the same interface. I would recommend xmlm for most use cases.
Archive: https://discuss.ocaml.org/t/ann-containers-2-0/1552/1
Simon Cruanes announced:I'm happy to announce that Containers 2.0 is released and should land on opam shortly. There were some improvements since the last [announce](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454). The new changelog is [there](https://github.com/c-cube/ocaml-containers/blob/6b9f39d2240b22a82a2167dee7d27c169ba530a6/CHANGELOG.adoc). However, the core of the changes is that dangerous polymorphic operators are hidden after `open Containers`, and are not relied upon anymore. There is a [migration guide](https://github.com/c-cube/ocaml-containers/blob/f78ee1bf92e9de4ae71ea2e506d7c576229654ff/README.adoc#migration-guide) for updating your code to 2.0. In short, `open Pervasives` following `open Containers` might ease the transition; printing functions are all named `pp`; and some optional arguments are now mandatory.
Archive: https://discuss.ocaml.org/t/exceptions-vs-option/1559/3
Didier Wenzek said:This recent post on [`r/ocaml`](https://www.reddit.com/r/ocaml/comments/7x4m0e/composable_error_handling_in_ocaml/) explores 4 ways to handle errors in OCaml. An interesting reading.
Here are links from many OCaml blogs aggregated at OCaml Planet, http://ocaml.org/community/planet/. OCamlPro’s Liquidity-lang demo at JFLA2018 – a smart-contract design language http://www.ocamlpro.com/2018/02/08/liquidity-smart-contract-deploy-live-demo-on-tezos-alphanet-jfla2018/
If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.
If you also wish to receive it every week by mail, you may subscribe online.