Pythonで関数型プログラミング
Pythonで
関数型プログラミング
https://docs.python.org/ja/3/howto/functional.html
イテレータ
や
ジェネレータ
の説明から始まる
dictの反復順序は挿入順序と同じ
組み込み関数
map (Python)
filter (Python)
enumerate
sorted
any (Python)
all (Python)
zip (Python)
itertools
functools
reduceはこれを使う
lambda
map, filterあたりは
内包表記
を使って書いたほうが良いとされている
高速
lambda式不要
読みやすい(人による)
個人的には内包表記のほうが読みやすい
rmaruon.icon
Pythonを使って関数型プログラミング Part.1 - ログミーTech