Any SML coders able to translate this to Python?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Sep 7 20:10:07 EDT 2018


On Fri, 07 Sep 2018 15:10:10 +0100, Paul Moore wrote:

> On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
[...]

>> However I have a follow up question. Why the "let" construct in the
>> first place? Is this just a matter of principle, "put everything in its
>> own scope as a matter of precautionary code hygiene"? Because I can't
>> see any advantage to the inner function:
> 
> My impression is that this is just functional programming "good style".
> As you say, it's not needed, it's just "keep things valid in the
> smallest range possible". Probably also related to the mathematical
> style of naming sub-expressions. Also, it's probably the case that in a
> (compiled) functional language like SML, the compiler can optimise this
> to avoid any actual inner function, leaving it as nothing more than a
> temporary name.

I guessed it would be something like that.


Thanks Paul, and especially Marko for going above and beyond the call of 
duty with his multiple translations into functional-style Python, and 
everyone else who answered.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list