Facebook
From newcomer, 7 Years ago, written in OCaml (Objective Caml).
Embed
Download Paste or View Raw
Hits: 304
  1. let f ~l ~m x y = x + y - (l + m);;
  2. f 4 5 1 2;; (*works fine, treats labelled arguments as positional*)
  3. f ~m:5 ~l:4 1 2;; (*works fine, that's the whole purpose of labelled arguments*)
  4. f ~m:5 1 2 ~l:4;; (*works fine, that's the whole purpose of labelled arguments*)
  5. (*f ~m:5 4 1 2;;*) (*doesn't work!*)
  6. let g = f ~m:5;;
  7. g 4 1 2;; (*works fine,treats labelled arguments as positional*)