{X with value} in ocaml

This is sometimes called a “record update” or “functional update” or something like that. It evaluates to a new record of the same type as X, and whose fields are initialized to the same as those in X, except the ones which are listed after the “with”, which are initialized to those given values. It … Read more

What is the state of OCaml’s parallelization abilities?

This 2009 issue of the Caml weekly news (“CWN”, a digest of interesting messages from the caml list) shows that: the official party line on threads and Ocaml hasn’t changed. A notable quote: (…) in general, the whole standard library is not thread-safe. Probably that should be stated in the documentation for the threads library, … Read more

Print a List in OCaml

You should become familiar with the List.iter and List.map functions. They are essential for programming in OCaml. If you also get comfortable with the Printf module, you can then write: open Printf let a = [1;2;3;4;5] let () = List.iter (printf “%d “) a I open Printf in most of my code because I use … Read more

What’s the difference (if any) between Standard ML’s module system and OCaml module system?

There are some differences feature-wise, as well as semantically. Features SML supports but not OCaml: transparent signature ascription module-level let symmetric sharing constraints syntactic sugar for functors over types and values Features OCaml 4 has but not SML: higher-order functors recursive modules local modules nested signatures modules as first-class values general module sharing (sig with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)