Hacker News new | ask | show | jobs
by atombender 2443 days ago
Right, I'm not sure with OCaml is inconsistent there. -> is also used in pattern matching and in the syntax "fun x -> x + 1", perhaps it's some historical thing to avoid ambiguity?
1 comments

The above usage of -> is a syntax error in OCaml, -> can be used in the left hand side of a let expression, but only as part of a type expression. As you say the other usage is used to construct terms (clauses) that are used in pattern matching, of course Haskell does something similar.

The Rust syntax seems to emulate functional programming, but inconsistently since -> is not used purely as a type constructor or term constructor something like a mix of both in the defintion of functions, also it doesn't seem to support currying.