Facebook
From newcomer, 7 Years ago, written in OCaml (Objective Caml).
This paste is a reply to Re: confusing_labelled_arguments from newcomer - go back
Embed
let f ~l ~m x y = x + y - (l + m);;
f 4 5 1 2;; (*works fine, treats labelled arguments as positional*)
f ~m:5 ~l:4 1 2;; (*works fine, that's the whole purpose of labelled arguments*)
f ~m:5 1 2 ~l:4;; (*works fine, that's the whole purpose of labelled arguments*)
(*f ~m:5 4 1 2;;*) (*doesn't work!*)
let g = f ~m:5;;
g 4 1 2;; (*works fine,treats labelled arguments as positional*)