4 ms·
OMG there are multiline lambdas!!! https://coconut.readthedocs.io/en/master/DOCS.html#statement-lambdas https://coconut.readthedocs.io/en/master/DOCS.html#state
by ghj 6y ago
OMG there are multiline lambdas!!! https://coconut.readthedocs.io/en/master/DOCS.html#statement-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-lambda-in-python-why-not 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])