home > 比較編 > Perl, PHP, Python, Ruby > arrays >

ForNext

Only Do What Only You Can Do

121. filter

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 }



PowerShell

Scala

F#

C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system