Skip to content

Instantly share code, notes, and snippets.

View rodrigolive's full-sized avatar

Rodrigo de Oliveira Gonzalez rodrigolive

View GitHub Profile
@rodrigolive
rodrigolive / gist:820224
Created February 10, 2011 10:01 — forked from kitchen/gist:817748
Find even numbers in a list - cleaner with not
#perl
grep { not $_ % 2 } (1,2,3,4)
#ruby
[1,2,3,4].select{ |x| x.even? }
#python
[x for x in [1,2,3,4] if not x%2]
#or, more norvingly
filter(lambda x: not x%2, [1,2,3,4])