Comment Comment by asher Given a = [1, 2, 3, 4, 5]: Ruby: a.map{|i| i+1}.reject{|i| i%3 == 0}.map{|i| i*i} Python: [i*i for i in filter(lambda i: i%3 != 0, [i+1 for i in a])] Please ignore the fact that the whole operation can be simplified mathematically - nontrivial map-grep-map operations do occur.I find the Ruby version clearer because it proceeds from left to right like a shell pipeline. parent asher 16 years ago
I find the Ruby version clearer because it proceeds from left to right like a shell pipeline.