Hacker News new | ask | show | jobs
by georgyo 1465 days ago
I thought more languages did this but at least nix and ocaml do not actually behave like I thought.

In Ruby however it is a bit more ugly

  def f x
    x + 1
  end

  puts f f 1
> 3
1 comments

I don't understand your objection, what output would you like to see instead?
GP's point is that while yes, we know since `f` has arity 1 there's no ambiguity, in general you might not have the arity of any given function fresh in your head, and therefore can't tell (in Ruby) just from looking at `f f 1` whether it means a single invocation of an arity 2 function, or two invocations of an arity 1 function
Ah! Right. It helps to have all functions be of arity 1 to disambiguate, yes.