3 ms·
That DOES seem easy, but it's because the code you wrote only works for functions of two arguments. Can you write a Haskell version that works for functions wi
by mcherm 1y ago
That DOES seem easy, but it's because the code you wrote only works for functions of two arguments.
Can you write a Haskell version that works for functions with any number of arguments?
- rcxdude 1y agoDoesn't that version work with arbitrary numbers of arguments already thanks to currying?
- hackyhacky 1y agoSort of: the version I gave flips the first two parameters of a function, leaving the rest untouched. The C++ std::flip from the article, however, reverses the order of all parameters. Reproducing that in Haskell would require fancy type-level programming or compile-time metaprogramming, both of which would defeat the simplicity of my initial version.