develooper Front page | perl.perl6.users | Postings from July 2017

flatmap considered harmful?

Thread Next
From:
Sean McAfee
Date:
July 27, 2017 18:39
Subject:
flatmap considered harmful?
Message ID:
CANan03b_VAM4gwhBJ3pgePw9h_Jmq75XBBZe07JzC27zVKCfnw@mail.gmail.com
While browsing the Perl 6 docs recently, here:

https://docs.perl6.org/type/List#method_flatmap

I noticed this paragraph for the first time:

It is considered *bad practice* to use flatmap. Instead of .flatmap( ),
> please use .map( ).flat as it is clear when the .flat is called and is
> not confusing like .flatmap.
>

To quote a certain president's lawyer:  Says who?

Flat-mapping is awesome; I've written code that does it in several
different programming languages, in none of which is it deprecated in this
way.  Is there really any reason to avoid it in Perl 6 other than
subjective notions of how confusing it is?

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About