List of Scala’s “magic” functions

As far as I know: Getters/setters related: apply update identifier_= Pattern matching: unapply unapplySeq For-comprehensions: map flatMap filter withFilter foreach Prefixed operators: unary_+ unary_- unary_! unary_~ Beyond that, any implicit from A to B. Scala will also convert A <op>= B into A = A <op> B, if the former operator isn’t defined, “op” is … Read more

Unary minus and floating point number in OCaml

Here’s how I think it goes (after reading docs and experimenting). There really are four completely different operators: – Integer subtraction int -> int -> int -. Floating subtraction float -> float -> float ~- Integer unary negation int -> int ~-. Floating unary negation float -> float If everybody used these operators, things would … Read more