News for hackers. Stuff that matters.
Re:Porting 4.5K lines of C to Go by seanwilson on Saturday August 05, 2017 @08:24AM (#14935379)
The ternary operator can be nice for conciseness and to ensure a variable has been assigned to when the language doesn't check that for you e.g.

    var x = condition ? 1 : 2;
vs

    var x;
    if (condition)
      x = 1 
    else 
      x = 2
I miss being able to write code like this in languages like OCaml:

    let x =
      if (condition) then
        // more lines of code
        1
      else 
        2
Re:Porting 4.5K lines of C to Go by girvo on Monday August 07, 2017 @05:24PM (#14951390)
Heh your OCaml example is why I adore Nim, and any other languages that "expression all the things!" -- even modern JavaScript is decent on this front with 'ramda' and my favourite helper library @unction: https://github.com/krainboltgreene/unction.js/blob/core/READ...

Between those two, consise readable functional JS code based entirely around expressions is simple to achieve. It's genuinely made me happy to be back in JS land