ミームの死骸を待ちながら

We are built as gene machines and cultured as meme machines, but we have the power to turn against our creators. We, alone on earth, can rebel against the tyranny of the selfish replicators. - Richard Dawkins "Selfish Gene"

We are built as gene machines and cultured as meme machines, but we have the power to turn against our creators.
We, alone on earth, can rebel against the tyranny of the selfish replicators.
- Richard Dawkins "Selfish Gene"

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

"Ruby Recipe 061"「,」で区切られたデータ(CSV)を処理する

CSVを読む方法、書く方法。このレシピはよく使いそうなので覚えておこう。 RubyでCSVを読み込む require 'csv' CSV.parse("data.csv"){|row| p row } RubyでCSVを出力 下記参照。writterを呼ぶのは一度だけっぽい。 以上 Rubyレシピブック 第2版 268の技作者…

"Ruby Recipe 061"文字列の一部を破壊的に削除する

「ある文字列を正規表現で指定して、""で置換する」という考え方。sub!あるいはgsub!を使う。 sub系は 第一引数で正規表現「/hogehoge/」あるいは特定の文字列「"hogehoge"」 第二引数で置換先の文字列 指定した位置に文字列を挿入する方法も。 str.sub!(/\A…

"Ruby Recipe 043"正規表現にマッチした部分の前後の文字列を取り出す

Rubistとして精進するため、Rubyレシピブック 第2版 268の技のレシピのうち 必要に迫られて 最初から順に、勉強として 使用/実践したものをブログにあげていく。備忘録、継続のための公開という用途の他に「たしか前勉強したのに…」という内容をブログ内サー…