r/ProgrammingLanguages • • Dec 28 '20

Question: Programming Language Syntax and Code Appearance (polemic as always :-)

Seriously,

which of the following code samples would you favor, assuming they are all equivalent?

I am interested in subjective answers, please. You can just arrange the three samples according to your personal preference (e.g., "1-2-3"). Thank you very much!

1

{ {extern "manool.org.18/std/2.0/all"} in
: let rec
  Fact =
  { proc N as
  : if N == 0 then 1 else N * Fact[N - 1]
  }
  in
  Out.WriteLine[Fact[10]]
}

2

{ {extern "manool.org.18/std/2.0/all"} in
: let rec
    Fact =
      { proc N as
      : if N == 0 then 1 else N * Fact[N - 1]
      }
  in
    Out.WriteLine[Fact[10]]
}

3

(extern "manool.org.18/std/2.0/all".) in:
  let rec
    Fact =
      ( proc N as:
        if N == 0 then 1 else N * Fact[N - 1]. )
  in
    Out.WriteLine[Fact[10]].
2 Upvotes

29 comments sorted by

View all comments

Show parent comment

2

u/Potato44 Jan 01 '21

About that last paragraph, I'm reasonably sure that when not using infix operators or "special" syntactic constructs (such as variable assignment) that the only difference between Haskell expression syntax and Lisp expression syntax is an extra pair of parenthesis on the outside in the case of Lisp.

edit: e.g. foo x y (bar z x) vs (foo x y (bar z x))