2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

hxLINQ というのがあったので使ってみた。

Last updated at Posted at 2012-09-25

hxLINQ というのがあったので使ってみた。
JSLinq をベースにして作られたものらしい。
Flash/JS/PHP/Neko/C++ でテスト済だそうです。

導入

まず、 hxLINQ をインストールします。

haxelib install hxLINQ

Sublime Text2 と haxe-sublime2-bundle を使っている場合は、shift+ctrl+L で ライブラリの一覧が出るのでそこから選択するだけです。チョーイーネ!

使い方

こんな感じで。

hxLINQExample.hx
var it = new hxLINQ.LINQ([1,2,3,4,5,6,7,8,9])
.where(function(v:Int, i:Int):Bool {
	return v % 2 == 0; // 抽出(偶数のみ)
})
.select(function(v:Int):Float {
	return v / 10.0; // 加工(10で除算)
})
.iterator();

while(it.hasNext()) {
	trace(it.next()); // out:0.2, 0.4, 0.6, 0.8
}

ひと通りの機能は揃ってるので使えそうな感じだけど、Rx の機能まで求めてしまうのは贅沢でしょうか。

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?