Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Erlang does it very much like GP's suggestion with the one downside of being 'noisy' with its punctuation (some might say 'clearer'):

  factorial(0) -> 1;
  factorial(N) -> N * factorial(N-1).

  factorial(Foo, 0) -> .. ;
  factorial(Foo, Bar) -> .. .
Semicolons separate partial definitions for a single function of a single arity, and periods end those definitions. Removing the punctuation might make parsing a bit more difficult (will there be more partial definitions?), so it's understandable to not offer it.


Off-topic: I'm kinda new here, what does GP stand for ?


The grandparent comment, as opposed to the parent comment or the original post.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: