Dear all,
Thanks for this inspiring discussion.
The integration of large pieces of code into OCaml standard library is maybe not the best solution as it will never fulfill everyone's needs. I like the idea of having a Swiss army knife standard library rather than a heavy weight set of tools. However, filling existing minor gaps in the standard library would probably improve programmers day-to-day experience. Below are some examples:
- Integers, floats and options, for instance, would deserve their own module for functor application.
- More functions on option type, such as eval, iter, map. Something like this:
let eval f x = try Some (f x) with _ -> None
let iter f = function None -> () | Some x -> f x
let map f = function None -> None | Some x -> eval f x
- The standard library includes incr and decr on integer references, but none of the useful C-like operators with assignment such as += that save a lot of time in situations (there are some) where references are heavily used.
let ( += ) r n = r := !r + n
- An efficient set of string searching functions would help a lot (no regexp). Something like Boyer-Moore, KMP or even Rabin-Karp algorithms.
- String.explode / implode to convert to/from char list.
- Trivial functions such as read_file or read_text_file.
- The identity function!
- All fold functions should have a foldi counterpart, and the same set of iterators should occur in all modules.
Then, for more specialized requirements, I think it may be better to contribute directly to improve third party libraries.
Kind regards,
Edouard