2018-01-31から1日間の記事一覧
TL;DR パイプライン演算子いいね このごろ新しく言語を見る時、Hello world の次くらいに偶数自乗和を 作る関数を定義してる。Ruby で書くとこんな感じ。 def even_square_sum(n) (1..n) .select {|n| n % 2 == 0} .map {|n| n * n} .inject {|acc, n| n + a…
TL;DR パイプライン演算子いいね このごろ新しく言語を見る時、Hello world の次くらいに偶数自乗和を 作る関数を定義してる。Ruby で書くとこんな感じ。 def even_square_sum(n) (1..n) .select {|n| n % 2 == 0} .map {|n| n * n} .inject {|acc, n| n + a…