News for hackers. Stuff that matters.
Re:Coconut: Simple, elegant, Pythonic functional programming by ghj on Tuesday July 07, 2020 @01:54PM (#23762031)
OMG there are multiline lambdas!!! https://coconut.readthedocs.io/en/master/DOCS.html#statement...

But trying it out, it doesn't even look like python anymore. Especially if you want to nest them a lot like in other callback heavy languages. It requires a lot of semicolons and parens to get past the parsing ambiguity problem: https://stackoverflow.com/questions/1233448/no-multiline-lam...

    # Incorrect, the lambda returns (y, [1,2,3]) here!
    map(def (x) ->
          y=x+1;
          return y
    , [1,2,3])
    
    # Right
    map((def (x) ->
          y=x+1;
          return y
    ), [1,2,3])
Re:Coconut: Simple, elegant, Pythonic functional programming by eindiran on Tuesday July 07, 2020 @06:56PM (#23765152)
A more Coconutty way to write this might be:

    [1, 2, 3] |> map$(def (x) -> y = x + 1; return y)
Which looks even less Pythonic.
Re:Coconut: Simple, elegant, Pythonic functional programming by jtdev on Tuesday July 07, 2020 @08:16PM (#23765745)
Wow! That looks awful.