I really do write Python all functional likehttp://exercism.io/submissions/48505fcb829440ddad99bfb77dc96664 …
-
-
Mentally, what I am doing is applying a well-defined permutation to every element in a linked list, not walking through a string and building a new one element by element.
Show this thread -
I want a function doo-hickey to apply to each thing. I want to apply them to the collection of things all at once and return the right result. Ultimately, it's the same thing when it comes down to the code bits. But I like when my code looks like my mental model.
Show this thread -
There are some legitimate benefits to this approach. It makes it easier to debug. We've decomposed all of the logical operations into distinct parts, not one big mashup of imperative top-down code.
Show this thread -
It makes the exception handling clear: if an exception happens, it's because the input has an unexpected value, and not because, idk, we've iterated out of bounds or something. There's no code that leaks into the if statements. We don't need breaks.
Show this thread -
This is all to say I really wish Data Science as a field used a language that was more naturally connected to functional analysis.
Show this thread
End of conversation
New conversation -
-
-
Yeah, but that's not anywhere remotely near the scope of the problem.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
string.translate would do it (without the error handling) in a single line. https://docs.python.org/3/library/stdtypes.html#str.translate …
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.