Re:You, Too, Can Be on the Cutting Edge of Functional Progra...
by eru on Wednesday May 09, 2012 @11:09AM
(#3948907)
Slightly off-topic: In Python you will also benefit from using the sorted and reverse functions to avoid mutability. Generator functions are a nice way to build collections without using explicit append:
def collection ():
list = []
while someLoopCondition ():
while someOtherLoopCondition ():
list.append (someStuff ())
return list
vs def collection2():
while someCondition ():
while someOtherLoopCondition ():
yield someStuff ()
The primary consequence was to improve my use of my native language, Python -- I'm much more likely to use all() and any() and map() and reduce() and set() where they make sense, to think of my functions in terms of composability, etc. I'm not sure that I'll ever put in the time to be fluent in Clojure, but I'm glad I spent some time stumbling through it.