ForNext
Only Do What Only You Can Do
121. filter
Hyperpolyglot Interpreted Languages: PHP, Perl, Python, Ruby より (2012.05.08)
VBScript
JScript
Perl
grep { $_ > 1 } (1,2,3)
PHP
array_filter(array(1,2,3), function ($x) { return $x>1; })
Python
filter(lambda x: x > 1, [1,2,3]) # or use list comprehension: [x for x in [1,2,3] if x > 1]
Ruby
[1,2,3].select { |o| o > 1 }