Skip to main content
4 events
when toggle format what by license comment
Apr 24, 2019 at 10:07 comment added Nicola Bernini This is the strategy I adopt typically for my hybrid functional style, but not in this case as I was trying to reimplement next_permutation but in production code that’s what I tend to do. C++ does not need be Haskell, but some C++ programmer would certainly take benefit from some exposure to Haskell :)
Apr 24, 2019 at 9:44 comment added papagaga @NicolaBernini: well, you can always put next_permutation into a functional shell (like you do with insert, push_back, etc. in your helper functions). I also like functional programming a lot, and have tried a few times to adopt functional idioms in C++ but there's always a point where you understand C++ won't ever be Haskell. But yeah, sure!
Apr 24, 2019 at 9:25 comment added Nicola Bernini I understand your point and thanks for sharing it, but I have to do bias disclosure now: I (strongly) favour functional style over imperative (which does not mean I’m a purist, otherwise I would not have used loops, I’m just trying to take the best of both worlds) Certainly it can have a performance cost (depends how smart the compiler is) but I think it is not necessary for me to list the joys functional programming
Apr 24, 2019 at 9:13 history answered papagaga CC BY-SA 4.0