2013-03-12から1日間の記事一覧

ラムダ++

#include <iostream> int main() { for (int i = 0; i < 10; ++i) { auto x = [=](){ return i; }; std::cout << x() << std::endl; } } prog_cpp$ g++ -std=c++0x hellolambda.cpp prog_cpp$ ./a.out 0 1 2 3 4 5 6 7 8 9 prog_cpp$</iostream>

ラムダラムダ

TypeScriptは ()=> で Java8は ()-> なのか。辛い。2013-03-12 13:58:59 via SoraUsagi C++ [](int x) { return x > 0; } Python lambda x: x > 0 Ruby -> x { x > 0 } Haskell \x -> x > 0 C# x => x > 0 CoffeeScript (x) -> x > 0