Does your type system work on you? Refined types in Clojure
speakerdeck.com1 pointsby kachayev0 comments
reduce(operator.add, map(len, ss))
You know, it's hard to understand new concept. And it's twice harder to explain new concept with sophisticated code examples. So I used as simple code and situations as possible. The same for square_sum - it's easier "to see" functional pattern in map(f,l) than in (f(x) for x in l). debug = partial(log, "debug")
is easier and meaningfully describe what's actually going on. But here we have only one function, what if you have to create 5-6 same functions? Would you prefer "def" syntax instead of partial? I have one more example of using this pattern in more sophisticated situation - code listing for dictionary binding to list of functions, "partial" looks really naturally.
It "easy". Cause it takes less characters in your code: you don't need "type classes" of any form, you don't care about liftings etc. You can start from 2-3 lines of code and see immediate result.
But it's really not that "simple", cause without constant thinking about type of each expr it becomes very hard to trace long chains of monad operations very quickly. Plus types are great for verifying that you didn't break anything inside your "do" block (which is painful in dynamic env).