len(values[s]) for s in squares)
(map (comp count values) squares)
How is that better! If you know the standard function this is super easy (in both languages). Note clojure is just one pure function call nothing fancy.
(inc (apply max
1+max
The expressivness is tiny bit better in python because the max function looks at the type of the input. apply is a commen pattern that is easy to anderstand. The python way is a little bit easier to read but the clojure way makes the library simpler.
line = '+'.join(['-'*(width*3)]*3)
line (join \+ (repeat 3 (join (repeat (* 3 width) \-))))
The thing that makes python shorter here is that they alow math on non number. I don't think that a good idea in general but that up to the language designers taste. The diffrence between the code is basiclly that in clojure you have to use repeat two times instead of * and one more join.
So only real diffrences are on the first line clojure uses apply and on the second repeat instead of join.
I think is just a matter of training. Much harder then the language reading is to know what the standard functions really do.
So only real diffrences are on the first line clojure uses apply and on the second repeat instead of join.
I think is just a matter of training. Much harder then the language reading is to know what the standard functions really do.