ときどきの雑記帖 リターンズi戦士篇

I'd just be the catcher in the rye and all. I know it's crazy, but that's the only thing I'd really like to be. I know it's crazy.

The catcher in the rye
J. D. Salinger

著作権保護期間の70年延長に反対

検索エンジン経由でこられた方へ

このページの内容は日々更新されます。 そのため、検索エンジンに引っかかったものがここに残っているとは限りません。 同じ内容のものは zakkicho[0-9]+.html なページに多分あります。 特に逆ポーランド記法←→中置記法の変換に関して探している人は ここ とか ここ にあります。

最新エントリ (何日分あるかは不定)

2009年11月22日

■_

・ビジョナリー・カンパニー
図書館で借りて読んだんですが微妙… どこかでほめてた記事を見て借りたと思うんですけどなんというか。 ビジョナリー・カンパニーとして挙げられているのにウォルマートやモトローラがあるんですが、 本が出版された(1994年頃?)時点はともかく今現在はどうかというと、うーん。 モトローラのところで「アップルにMPUが採用されて云々」という一文があったりするのが 経過した時間を感じさせるなあと。


Twitter / いーぐるとまと: そういえば昨日の話では Lisp は関数型じゃないし ...Twitter / いーぐるとまと: C++ ですかね


URLを見失っちゃったんですが、 数日前にソースコードの読みやすさに空白や空行がかなり影響しているという レポートがあったんですよね。もうちょっと詳しく読もうと思ってたのに。えぐ。


一週間くらいについったでつぶやいたんですが、8bit マイコン時代のとある本を探しています。 とはいってもタイトルも出版社も著者すら覚えていないという(苦笑) ただ、Z-80をターゲットにしたコンパイラーの本で、割と厚めのボリュームだったてのは覚えてます。 これまた名前を覚えていないのですが、オリジナルの言語を実装していてほぼ全編実装技術の 詳細の説明だったような記憶が。 国会図書館にでも行くか。

■_ 本日のム板から

マ板の方は生々しすぎたりしてちょっとというのがあったり。

推薦図書/必読書のためのスレッド 52 
930 デフォルトの名無しさん [sage] 2009/11/21(土) 22:30:03 ID: Be:
    雑誌じゃないけど、DDJのアルゴリズムセットCDROMは新しいの出るのかな…
    Introduction to Algorithmsだけ新しくなんないかな 

931 デフォルトの名無しさん [sage] 2009/11/21(土) 23:46:39 ID: Be:
    ちょま,結婚すると技術書まで邪魔扱いで捨てられるのか!!!女こえええ 

932 デフォルトの名無しさん [sage] 2009/11/22(日) 00:15:59 ID: Be:
    bitのバックナンバーを捨ててから、教授の様子がおかしい 

933 デフォルトの名無しさん [] 2009/11/22(日) 00:19:10 ID: Be:
    テクノポリスのバックナンバーを拾ってから、ティッシュの減りが早い 

934 デフォルトの名無しさん [sage] 2009/11/22(日) 00:27:31 ID: Be:
    お前らもいずれ動物本捨てられて代わりに虚ろな顔で毎週末動物園に通うようになるんだよ 

935 デフォルトの名無しさん [sage] 2009/11/22(日) 00:36:47 ID: Be:
    升席もありえるな 

936 デフォルトの名無しさん [sage] 2009/11/22(日) 00:37:54 ID: Be:
    なんか流れがおかしい 

937 デフォルトの名無しさん [sage] 2009/11/22(日) 00:44:58 ID: Be:
    このスレではおかしいのがデフォルト 

938 デフォルトの名無しさん [sage] 2009/11/22(日) 05:14:59 ID: Be:
    >>931
      2次元    3次元  
       │      │  
       │     告白  
       │   ┌─┴─┐  
       │  失敗   成功  
       │   │ ┌─┴─┐  
       │   │ 破局   結婚  
       │   │ │  ┌─┴─┐  
       │   │ │  搾取 子供誕生  
       │   │ │  │   ┌─┴─┐  
       │   │ │  │ 邪魔者化  離婚  
       │   │ │  │    │     │  
       │   │ ↓  ↓    │  慰謝料・養育費  
       │   └→生き地獄.←┴───┘  
       │  
       │  
       │  
       │  
       ↓  
      天国   


なんという流れかw

■_

スレッドのタイトルが気になったので中身を確認したらなんのことはなかったり。

Microsoft decided C is deprecated : programming
Microsoft decided C is deprecated (self.programming)

(this is all quite old, as it started with MS Visual Studio 2005 but I'm starting to 
experience it now, and would like to see users opinions and how they've been dealing 
with this)

My older C++ code which included well known C functions such as strcpy, fopen, fscanf, 
scanf, fdopen, etc. are now deprecated by Microsoft and their use issues a warning. 
But their MS-only replacements are in fact potentially as insecure as the old ones.

What do you do with this situations? (replace the calls with whatever_s making the 
code non portable, disable warnings, defining MS suggested symbols such as 
_CRT_SECURE_NO_DEPRECATE which have no effect here, ...)

fopen_s や fscanf_s はまあちょっと微妙ではあるけれども、strcpy/strcat/strncpy を 使うのを止めましょうというのは賛成したいところ。 ただまあスレッドのコメントにもあるんですが、 「わかっている」人はきちんと領域のサイズなんかは考えて組んでいるから余計なお世話だろう というのはその通りなんですよね。Urlich とかもそうだったかな。 特にセキュリティがらみのバグでバッファオーバーフローが原因でというのは割りとよく目にする と思うんですが、その内、str* が絡んでいるというのはどのくらいあるんでしょうね。 特に商用のプロプラなプロダクトでの数字を知りたいけど無理だろうなあ。

■_ みねこあさんからお手紙着いた(違います)


つれづれ - みねこあ

2009-11-21 ■つれづれ

その132

C++の参照の話が予想に反してホッテントリで、ちょっと驚いています。最初、喩え話が過ぎて
「これはひどい」祭りが起きたんだと思ってビビりました。(きむら(K)さんとかに怒られたか!?
とか思ったり)

わたしは小心者なので先にいいわけしてしまいます。あれは単なる比喩と捉えた方が良くって、
特に C++ の参照としてはいまいち正しくはないです。

いやあむしろ、あの風船のたとえは面白いという意見を見かけたですよ。 それはわたしも同じです。

その137

わかったり聞いたりわからなかったりするはなし。

わたしも新人のとき先輩に「わからないところを何で聞きに来ないっ!」と怒られたことがあり
ますが、「何処が解らないのか解らないんですっ!」と逆ギレ(?)して答えた思い出があります。

・・これはこれで、どうなんでしょ。

まあいろいろありますわな>訊きにいかない/こない

その142

true tears のBlu-ray ですが、どうしましょう、と悩んでおります。

ごらんのとおり、わたくし true tears が大好きです。(ちなみにわたくし乃絵派ですの)

普段だったら絶対買ってたのですが、この不景気で収入は激減ですし、ボーナスも絶望的ですし、
貯金を切り崩して買うしか手がない状況です。

本当にどうしたものかしら。うーむ。
  

逃すと再販はないでしょうしねえ。

■_

これ、前のバージョン読んで感心したんだけど(十年前だったのか。途中まで訳したんだよな)、 バージョンアップしたのですね。 でもさっきアクセスしたら、new: と slide: のアドレスはなにもないような? tar 玉は拾えるようですが。

Journal of rurban (7989)

Back in 1998 Gisle Aas prepared a graphical overview of all the major internal perl structures, as described in perlguts.pod

However this all changed with 5.10, and since nobody else did it and I helps me 
immensely to work on the compiler, I updated illguts ("illustrated guts") to 
the current perl state.

old: http://cpansearch.perl.org/src/GAAS/illguts-0.09/index.html
new: http://rurban.xarch.at/software/perl/illguts-0.10/
slides: http://rurban.xarch.at/software/perl/illguts-0.10/slides/
tardist: http://rurban.xarch.at/software/perl/illguts-0.10.tar.gz

I asked Gisle for co-maint so that I can upload it to CPAN soon.

■_ 本日の巡回から

  • Twitter / shino [ bizmode]: 円錐の体積が円柱の1/3である理由を、140文字以内 ...
  • Twitter / 菊次郎52歳: ET 2009 では、組み込み業界の高齢化を実感でき ...
  • Hexenkessel - 「地球シミュレータ」は何が凄かったのか
    金とモノをぶち込めば世界一になるってのは土建屋の発想でありコンピュータ・エンジニアの発想ではない。
  • Hexenkessel - 「地球シミュレータ」は何が凄かったのか
  • ウォルマート - Wikipedia
  • 日刊ベリタ : 記事 : 【IPSコラム】高利益のからくり ウォルマート商法の倫理を問う マーク・ソマー
  • 『化物語』・『ひだまりスケッチ』・『GA 芸術科アートデザインクラス』――2009年夏期新作アニメに関する討議1 - 反=アニメ批評
  • セブンイレブン限定「ガンダムマスコットストラップ」: コンビニ発見伝
    通常通るルートにセブンイレブンないんだよなあ。近くにないわけではないんだけど。
  • Twitter / やのつとむ: あと、日本ではオブジェクト指向は未だに「受け入れられ ...
  • Twitter / _ko1: Tokyo.rb みたいなの,誰か作ってくれないかな
  • APRESS.COM : Pro Scala: Monadic Design Patterns for the Web : 9781430228448
  • car/cdr - skobayasの日記
    car/cdrと言われてもねぇ。(しかも、「かー」とか「くだー」とか。SCEの前の社長じゃないんだから)
  • □■PC-88スレッド!■□
  • 昔の 8-bit OS (Apple,Commodore など) トピックのプロジェクト一覧 - ソフトウェアダウンロードマップ - SourceForge.JP
  • 昔の 8-bit OS (Apple,Commodore など) - スラッシュドット・ジャパン
  • SjASMPlus - Z80 Assembly Cross-Compiler プロジェクト トップページ - SourceForge.JP
  • Books for PC-8801
  • Twitter / Yukihiro Matsumoto: 他人のブログへのコメントで行われる議論をトラックする ...
  • 揺動散逸日記 C++ template metaprogrammingでサンクができていることを確認。
  • 心を亡くすと書いて忙しい - sodiumイオンにっき(2009-11-09)
  • タスクリストの“常連さん”をやっつけろ! - *ListFreak
    みみいてー
  • Using a Proof Assistant to Teach Programming Language Foundations (注: pdf)
  • Apple's Mistake : programming
  • ■_ あれ

    GlobalAlloc とか obsolete でなかったっけ?

    移動可能メモリ -OKWave
    
    GlobalAlloc関数を調べていたんですが、GlobalLockしてメモリを固定するといっているのですが、
    その意味がピンときません。
    
    GMEM_MOVEABLEで移動可能メモリの割り当てを行うようなんですが、
    アドレスが移動するってどういうことなんでしょう?
    固定メモリと移動可能メモリの違いってなんでしょうか?
    

    3.1 の時点ですでに GlobalAlloc →GlobalLock/Unlock とかってあまり意味なかったものなあ (LockしっぱなしでOK)。

    2009年11月21日

    ■_

    「素数の音楽」があんなに厚い本だとは思わなかった ○| ̄|_ 「論理学をつくる」は大型本だったし。

    Haskellナイト 店員さんの髪の長い方のおねーちゃんが以下略

    明倫館書店で掘り出し物発見。 この調子で「物まね鳥をまねる」でもでてこないかなあ

    ■_ 今日のム板から

    Goネタはまとめるのが面倒だ。 まあ発表直後に比べればだいぶ落ち着いてるけど。

    Lisp Scheme Part28 
    489 デフォルトの名無しさん [sage] 2009/11/21(土) 00:15:01 ID: Be:
        lispを覚えてマクロ使いこなしても、俺の仕事は他人の作ったVBとかのクソコードのデバッグだけなんだよなぁ
        このスレの先輩諸氏はプログラマーらしい仕事に就けているんだろうか 
    
    490 デフォルトの名無しさん [sage] 2009/11/21(土) 00:51:58 ID: Be:
        SICPを少しずつかたづけてるオレだが
        仕事ではexcelとaccessのVBAマクロ作ってる
        そんなもんだ 
    
    491 デフォルトの名無しさん [sage] 2009/11/21(土) 05:44:01 ID: Be:
        先輩諸氏がヘボばかりだったから
        世の中にLispの仕事がないんだよ 
    
    492 デフォルトの名無しさん [sage] 2009/11/21(土) 07:26:31 ID: Be:
        嫌ならやめろ 
    
    493 デフォルトの名無しさん [sage] 2009/11/21(土) 08:08:29 ID: Be:
        使いたきゃ使えばいいじゃん
        言語指定の仕事をもらってくる方が悪い 
    
    494 デフォルトの名無しさん [sage] 2009/11/21(土) 08:29:18 ID: Be:
        世の中そういう仕事しかないよ 
    
    495 デフォルトの名無しさん [sage] 2009/11/21(土) 08:34:20 ID: Be:
        レンズ研磨で生計を立てつつ哲学をしたスピノザのように、
        植木職人で生計を立てつつLisp道を究める求道者がいてもいいのではないか。 
    
    496 デフォルトの名無しさん [sage] 2009/11/21(土) 08:42:28 ID: Be:
        そういう人間しかいないだろ
        Lispやっている奴は 
    
    497 デフォルトの名無しさん [sage] 2009/11/21(土) 08:49:13 ID: Be:
        >>496
        そういう人間の方が真っ当だろう。
        嫌嫌、VBやって文句言っているよりはいいはずだ。 
    
    498 デフォルトの名無しさん [sage] 2009/11/21(土) 08:50:05 ID: Be:
        現実がわかってないな
        会社に入ったら命令されたことをやるしかないんだよ 
    
    499 デフォルトの名無しさん [sage] 2009/11/21(土) 08:56:34 ID: Be:
        と言うか、業務用として流行ってないところが魅力的なんだろ、LISPは。
    
        趣味の言語だからこそ高尚に感じられるw。 
    
    500 デフォルトの名無しさん [sage] 2009/11/21(土) 09:03:59 ID: Be:
        LISPでVBコード吐かせればいいだろ 
    
    501 デフォルトの名無しさん [sage] 2009/11/21(土) 09:05:38 ID: Be:
        マクロを使っただけでいんちき扱いされる世の中で
        そんなことが許されるわけないだろ 
    
    502 デフォルトの名無しさん [sage] 2009/11/21(土) 09:05:54 ID: Be:
        そこまでやったらVB直接書くほうが楽だろ 
    
    503 デフォルトの名無しさん [sage] 2009/11/21(土) 09:08:17 ID: Be:
        問題はreadableなコードを吐いてくれないこと 
    
    504 デフォルトの名無しさん [sage] 2009/11/21(土) 09:23:12 ID: Be:
        >>500
        黒田さんもそんなようなことをやったって記事を読んだような。
        Scheme->C の変換器を使って顧客に見つからないようにやったけど、
        結局、見つかってしまったのだとか。 
    
    505 デフォルトの名無しさん [sage] 2009/11/21(土) 09:28:36 ID: Be:
        1度の失敗だけで挫けたらダメ! 
    
    506 デフォルトの名無しさん [sage] 2009/11/21(土) 09:33:26 ID: Be:
        勝手にメンテナンス不能なコード作ったら
        顧客も怒るだろ 
    
    507 デフォルトの名無しさん [sage] 2009/11/21(土) 09:34:23 ID: Be:
        >>498
        それは低学歴だけw 
    
    510 デフォルトの名無しさん [sage] 2009/11/21(土) 09:47:33 ID: Be:
        >>507
        高学歴なら会社に入ったらLispがかけると思ったら大間違いだよ 
    
    511 デフォルトの名無しさん [sage] 2009/11/21(土) 10:09:32 ID: Be:
        再帰ですら理解不能な連中にプログラムなんて簡単とか、
        プログラマーなんて不要とか言われると我慢ならん 
    
    513 デフォルトの名無しさん [sage] 2009/11/21(土) 10:30:06 ID: Be:
        >>511
        その辺の連中のやってるプログラミングは単なるパズルだしな。
        ピースを誰が作ってるか、というところまでは想像できないんだろうな。 
    
    
    推薦図書/必読書のためのスレッド 52 
    907 デフォルトの名無しさん [sage] 2009/11/20(金) 15:30:24 ID: Be:
        ニート趣味プログラマーなのですが、コードコンプリートは上下巻ともに買ったほうがいいでしょうか? 
    
    908 デフォルトの名無しさん [] 2009/11/20(金) 15:31:29 ID: Be:
        はい。 
    
    909 デフォルトの名無しさん [sage] 2009/11/20(金) 15:39:37 ID: Be:
        >>907
        はっきり言って金と時間の無駄です。 
    
    914 デフォルトの名無しさん [sage] 2009/11/20(金) 18:57:43 ID: Be:
        上だけ買って読み終わったら下を買うことにして結局下を買わずに一生を終えればいい 
    
    916 デフォルトの名無しさん [sage] 2009/11/20(金) 20:27:29 ID: Be:
        俺が持ってるコードコンプリートって一冊組なんだよな・・・
        達人プログラマーもみんなが言ってるヤツと違うみたいな感じ 
    
    917 デフォルトの名無しさん [sage] 2009/11/20(金) 21:28:22 ID: Be:
        俺のコードコンプリートも分冊されてない。しかも英語で書かれてる。 
    
    918 デフォルトの名無しさん [sage] 2009/11/20(金) 21:28:29 ID: Be:
        達人は両方買ったけど、コードコンプリートってあれ以外あったっけ? 
    
    920 デフォルトの名無しさん [sage] 2009/11/20(金) 22:18:25 ID: Be:
        古いのなんじゃね? 
    
    921 デフォルトの名無しさん [sage] 2009/11/20(金) 23:21:59 ID: Be:
        >>920
        古いんだよw
        今見たら94年の初版だった 
    
    923 デフォルトの名無しさん [sage] 2009/11/21(土) 08:53:53 ID: Be:
        >914
        俺、これ読み終わったら下巻を買って彼女と結婚するんだ。 
    
    924 デフォルトの名無しさん [sage] 2009/11/21(土) 13:30:47 ID: Be:
        結婚したら本なんて買えなくなるからな
        毎月増える本に、冷たい目をされるんだぜ
        わかってて結婚したんじゃないのかよ… 
    
    925 デフォルトの名無しさん [sage] 2009/11/21(土) 14:26:01 ID: Be:
        独身でよかった…
        オライリーの一人図書館を作る予定w 
    
    926 デフォルトの名無しさん [sage] 2009/11/21(土) 14:54:05 ID: Be:
        雑誌バックナンバーを捨ててから、夫の様子がおかしい 
    
    927 デフォルトの名無しさん [sage] 2009/11/21(土) 18:30:37 ID: Be:
        雑誌バックナンバーならDVDとかで手に入りそうだから全く問題ないな。
        どうせ必要なのは雑誌の一部だ。
        場所取らないし、検索とかが便利になるし、むしろ買う口実に… 
    
    928 デフォルトの名無しさん [sage] 2009/11/21(土) 21:10:24 ID: Be:
        まるまるCマガジンを捨ててから、夫の様子がおかしい 
    
    929 デフォルトの名無しさん [sage] 2009/11/21(土) 21:35:03 ID: Be:
        なんてことしやがるんだ・・・ 
    
    

    まるまるCマガジンって、pdf化したのを納めたDVD のやつだよね。 創刊号から最終号まで収めたという。 そして気の毒な924。

    ■_

    あとでよむ

    
    
    SCG: PyGirl: Generating Whole-System VMs from High-Level Prototypes using PyPy
    
    PyGirl: Generating Whole-System VMs from High-Level Prototypes using PyPy
    
    Camillo Bruni and Toon Verwaest. PyGirl: Generating Whole-System VMs from High-Level 
    Prototypes using PyPy. In Objects, Components, Models and Patterns, Proceedings of 
    TOOLS Europe 2009, LNBIP 33 p. 328—347, Springer-Verlag, 2009. Details.
    
    Abstract
    
    Virtual machines (VMs) emulating hardware devices are generally implemented in 
    low-level languages for performance reasons. This results in unmaintainable systems 
    that are difficult to understand. In this paper we report on our experience using the 
    PyPy toolchain to improve the portability and reduce the complexity of whole-system VM 
    implementations. As a case study we implement a VM prototype for a Nintendo Game Boy, 
    called PyGirl, in which the high-level model is separated from low-level VM 
    implementation issues. We shed light on the process of refactoring from a low-level VM 
    implementation in Java to a high-level model in RPython. We show that our whole-system 
    VM written with PyPy is significantly less complex than standard implementations, 
    without substantial loss in performance.
    
    http://scg.unibe.ch/archive/papers/Brun09cPyGirl.pdf
    

    ■_ 本日の巡回から

    ■_ なんつーか

    訳しててなんじゃこらという印象ががががが。 コメントでも散々言われてるっぽいですが。

    Why learning Haskell/Python makes you a worse programmer « All Unkept
    
    Why learning Haskell/Python makes you a worse programmer
    
    Haskell や Python を学ぶことがなぜあなたを劣ったプログラマーにしてしまうのか
    
    I've found, contrary to what you sometimes read, that learning Python and Haskell has 
    not improved my programming using other languages. Haskell in particular, being so 
    different from imperative languages, is supposed to give new insights into programming 
    that will help you even when you are not using the language. My current experience 
    doesn't exactly tally with this, and here is why:
    
    あなたが時折り見かけることとは逆に、Python や Haskell を学んでも他の言語を使ったわたし
    のプログラミングを改良したりはしないということにわたしは気がつきました。特に Haskell 
    は命令型言語とはとてもかけ離れているので、たとえそれを使ったことがなかったとしてもあな
    たを助けてくれるであろうプログラミングに対する新しい insights を提供してくれると考えら
    れています。
    わたしの current experience は doesn't exactly tally with this,
    以下にその理由を挙げます:
    
       1. Demotivation. (やる気を失わせる)
    
          I find I think in Python, and even in Haskell to some extent, even though I have used
          Haskell very little. I constantly find myself wanting to use idioms from these
          languages, or noticing how much less code I'd be able to write if I was using one of
          these languages (which, although very different from each other, are both much more 
          powerful than the language I use at work, C#). It's very common for me to notice that 
          using either of these languages I could decrease a chunk of code by a factor of 2-5, 
          and not rare to see a factor of 10-20 in certain parts of the code base.
    
          わたしは自分が Python と、ほとんど使ったことがないので制限はありましたが Haskell です
          ら考えていることに気がつきました。わたしは、Haskell や Pyhtonにあったようなイディオムを
          使ってみたいとか、あるいは仮にそれらの言語を使ったときに自分がどのくらい少ないコードで
          それを書けるのか認識したいと常に思っていました (これら二つの言語はかなり違ったものでは
          ありますが、どちらもわたしが使っている言語である C# と比較するととても強力なものです)。
    It's very common for me to notice that
    それはわたしにはとても当たり前のことで
    認識するための
    using either of these languages I could decrease a chunk of code by a factor of 2-5, 
    Python や Haskellといったわたしが chunk of code を
    decrease できる
    and not rare to see a factor of 10-20 in certain parts of the code base.
    ほとんど見られない
    
    
          Further, my experience with Haskell means that I now see potential bugs everywhere in
          imperative code. Before, I was fairly well aware of the problems that stateful
          programming and side-effects can cause, having dealt with many scores of bugs related
          directly to this, and spent countless hours debugging these problems. But without any
          alternative, I guess I had just lived with it. Now I know there are other ways of
          doing these things, I find it difficult to be satisfied with any of the code I write.
          I am constantly aware that I am writing traps that other people are likely to fall in.
    
          さらに言えば、わたしの Haskell の経験は命令型コードの部分のいたるところで潜在的なバグを
          見つけさせることに繋がりました。以前は、 stateful programming と副作用が引き起こす可能
          性があり、それに直接関係する数多くのバグを扱ってそれらの問題をデバッグするのに
          countless hours を費やされるという問題に注意していました。けれども何の代替案もないので
          あれば、わたしはそれと共に生きていただろうと思います。今わたしはこれらのことがらを行う
          のに別のやり方があるということを知り、わたしの書いたどんなコードでも満足するのは難しい
          ことを理解しました。他の人が嵌り易い自分がトラップを書いてしまうことをわたしは常に気を
          つけています
    
          I also find C# code very ugly compared to both Python and Haskell. On the visual level,
          the mandatory use of braces everywhere (OK, they're not mandatory everywhere but are
          enforced by coding standards with good reason) makes code contain a lot of line noise
          and empty space, and combined with the verbosity of the libraries and type declarations
          etc, you find that a page of C# hardly does anything. I'm also thinking of beauty on the
          mathematical level, C# is a grubby mud hut compared to the breathtaking, elegant tower
          that is Haskell.
    
          わたしは C# で書いたコードが Python や Haskellで書いたそれに比べるととても ugly なことに
          も気がつきました。visual なレベルでは、あらゆるところで強制される (mandatory) ブレース
          (ああ、たしかにあらゆるところでは強制 (mandatory) されはしないかもしれませんが、good reason
          つきのコーディング規約で enforce はされますよね) は行ノイズと空スペースを抱え、verbosity of
          the libraries (ライブラリの冗長さ) と型宣言などとが合体したコードを作り出します。わたしは
          また、数学のレベルで美しさについて考えるのですが、息を呑むほどの elegant tower である Haskell
          と比較するとC# は grubby で泥でできた小屋です
    
          The net result of these things is to make me very depressed and demoralised. I feel
          like a human compiler, translating the Haskell or Python in my head into a language
          which is a whole level lower.
    
          these things の net result はわたしをとても落胆させ、やる気を失わせるものでした。
          わたしは自分の脳内に浮かんだ Haskell や Python のコードを水準の低い言語に変換する人間
          コンパイラーのようなものだと感じたのです。
    
       2. Using functional style obfuscates your code when using other languages.
          関数型のスタイルを使うことで他の言語を使うときにあなたのコードが読みにくいものになってしまう
    
          C# has begun to get some features that are more friendly to functional style programming.
          So, the other day, when faced with a very common situation I tried a functional solution.
          I have a list of Foo objects, each having a Description() method that returns a string. I
          need to concatenate all the non-empty descriptions, inserting newlines between them.
    
          C# はより関数スタイルのプログラミングがやりやすいようないくつかの機能を取り入れ始めました。
          ですから、先日わたしが非常に良くあるシチュエーションに直面したときにわたしは関数的ソリュー
          ション (functional solution) に挑戦したのです。Foo というオブジェクトのリストがあって、それ
          ぞれが文字列を返す Description() というメソッドを持っていました。そして空ではない description
          の全てを間に改行を挟んで連結する必要がありました。
    
          The code I wanted to write was this Python code:
          わたしが書きたかったコードはPython での以下のようなコードです:
    
          "\n".join(foo.description() for foo in mylist
                                   if foo.description() != "")
    
          Or this Haskell:
          Haskell ではこうです:
    
          concat $ List.intersperse "\n" $ filter (/= "") $ map description mylist
    
          Using generics from C# 2.0 and the methods they contain, the best I got was:
          C# 2.0 以降で使えるジェネリクスをメソッドで使うとすると
    
          string.Join("\n", mylist.ConvertAll<string>(
                      delegate(Foo foo)
                      {
                              return foo.Description();
                      }).FindAll(
                      delegate(string x)
                      {
                              return x != "";
                      }).ToArray());
    
          If I had been starting with a different data structure, the C# version would have
          been even worse -- and C# seems to have hundreds of different collection classes, 
          used inconsistently in the .NET libraries. Also I should point out that if you write 
          any methods that accept 'delegates' (the nearest thing to first class functions) you 
          have to declare the function signature for them separately if one doesn't exist 
          already (or if you don't know where to find one that already exists), further adding 
          to the bloat of any functional style code.
    
          もしわたしが別のデータ構造で始めたとしたならば、C# は .NET ライブラリの中で一貫性なく
          使われている異なるコレクションクラスを数百も持っているように思われるので、C# バージョ
          ンはより劣ったものになってしまうでしょう。同様に、'delegates' (first class functions
          に最も近い何か) を受け付けるなんらかのメソッドを書くならば、そのメソッドが既出でない場
          合 (もしくはどこにあるのかわからない場合) には関数のシグネチャ (function signature) を
          分割して宣言する必要があって、すべての関数的な形式のコードに追加して膨張させてしまいま
          す。
    
          There are some big problems with the C# version. The first is that there is very little
          reduction in size versus the imperative style code, if any. Compare to the tedious loop
          I would have written otherwise:
    
          C# バージョンには大きな問題が幾つかあります。第一に、命令型スタイルのコードに比べて大きさ
          の減少が、あったとしてもとても小さいということです。わたしが別に書いた tedious loop と比
          較してみましょう
    
          string retval = "";
          foreach (Foo foo in mylist)
          {
              string desc = foo.description();
              if (desc != "")
              {
                      if (retval != "")
                         retval += "\n";
                      retval += desc;
              }
          }
    
          There isn't much in it.
    
          Second, it took me longer to write. I had to do some experimenting to see how much
          type information I had to add to get it to compile (e.g. adding an explicit cast for
          the delegate turned out not to be necessary, but I did have to specify ConvertAll<string>
          instead of ConvertAll).
    
          第二に、それはわたしにとって書くのに長すぎるのです。わたしは以前、コンパイルのために
          取得し追加しなければならなかった型情報がどのくらいなのかを確認するためのちょっとした
          実験をする必要がありました
          (e.g. delegate に対する明確なキャストの追加は必要なくなりましたが、ConvertAll の代わ
          りに ConvertAll<string> と指定しなければなりませんでした)。
    
          Finally, there is the problem that this code will get me into trouble with my colleagues.
          Why am I writing such complex code -- using such advanced features as anonymous delegates
          -- when a simple loop would have sufficed? I actually left my functional version in, but
          was so embarrassed about it I had to add a brief explanatory note.
    
          最後がこのようなコードには同僚に対するトラブルを引き起こすという問題があるということです。
          なぜわたしは単純なループでも十分なときにも anonymous delegates (無名デリゲート) のような
          高度な機能を使ってこんなに複雑なコードを書いているのでしょうか? 実際にわたしが関数的なも
          のを書いたときには同僚がそれに困惑してしまうので、説明のための文章を追加しなければなりま
          せんでした。
    
          The fact is that functional idioms work badly in languages that don't have syntactic
          support for them. Java, from what I know, would have been much worse. C# suffers in
          that although some features that enable more functional programming have arrived in
          C# 2.0 (along with various other language improvements), huge chunks of .NET libraries
          have not been updated to take advantage of them, and our own code certainly hasn't.
    
          現実には関数型的なイディオムは、構文的にそれをサポートしていない言語では悪い方向に働き
          ます。わたしの知っているところでは Java がかなりひどくなっています。C# は 2.0 になって、
          より関数型プログラミングを可能にするいくつかの機能を (その他の言語の改良と一緒に)サポー
          トしてはいますが、.NET ライブラリの巨大な chunks はまだその利点を活かすように更新されて
          はいないし、わたしたち自身のコードもそうなっていないのです。
    
          It might be argued that you can still use the principles of functional programming
          (no side effects, functions depend only on their inputs etc) and get benefits that
          way, even if you can't use the idioms. In reality, libraries and frameworks designed
          for imperative languages just don't work like that. ASP.NET is an especially bad
          example. You develop controls by inheriting from Control and then overriding various
          methods. Most of these methods have no return value and no inputs, and work solely by
          mutating the state of the object (or other objects). They are then called by the
          framework in a somewhat subtle and complex order (yes, it is a nightmare to debug).
    
          あなたがたとえイディオムを使えなかったとしても関数型言語の原則 (副作用がなく、入力の
          みに依存する関数など) を使うことができて、それによる利益を得られるという主張があるか
          もしれません。実際には、ライブラリやフレームワークは命令型言語向けに設計されているの
          で関数型言語的には動作しないのです。ASP.NET は特に悪い例です。あなたは Control から
          継承しておいてから様々なメソッドをオーバーライドしてコントロールを開発します。このよ
          うな手法 (methods) の大半は return value も input もなく、そのメソッドを抱えているオ
          ブジェクトの(もしくは他のオブジェクトの)状態を変更することにより単独で動作します。そ
          うしたコントロールはその後、とてもわかりにくく複雑な順序(そう、それはデバッグ時の悪夢
          です)でフレームワークから呼び出されます。
    
          In fact, applying the principles of functional programming would lead me to use only
          static methods (no instance methods) as much as possible, avoiding anything that mutates
          states (or even has the possibility of mutating state). I would use a few ubiquitous,
          'dumb' datatypes, and keep algorithms separate from them. This flies in the face of the
          teachings, or at least the practices, of the main programming paradigm popular today, OOP.
          I can't apply what I think are good principles for writing code without rejecting the very
          paradigm of the language and libraries I am surrounded with. It's fairly hopeless.
    
          現実として、関数型プログラミングの原則を適用することはわたしに可能な限り (インスタンス
          メソッドではなく) スタティックメソッドだけを使うようにさせ、状態を変更するあらゆることを
          排除 (or even has the possibility of mutating state) するようにさせました。
          I would use a few ubiquitous, 'dumb' datatypes, and keep algorithms separate from them.
          これは今日ポピュラーな主流のプログラミングについてのパラダイムである OOP の教え、すくな
          くとも practices とは反しています。コードを書くための良い原則であるとわたしが考えている
          ものを、わたしを囲んでいる言語やライブラリの very paradigm を reject することなしに
          わたしは適用することができませんでした。それはとても希望のないことなのです。
    
    So, learning Python and Haskell has demoralised me and encouraged me to write code 
    that is bizarre and difficult to understand, and, in the context of an OOP code base, 
    provides little benefit over imperative programming. I have no doubt that in general I 
    am a better programmer for learning these languages, but in my current situation, I am 
    not a better software developer -- my productivity has in fact nose-dived. When I get 
    frustrated with the C# code I write, I then go and write it again in Haskell and 
    Python, to demonstrate to myself how much better they are, which is a pointless 
    exercise that only demotivates me further.
    
    ですから Python や Haskell を学ぶことはわたしを demoralised (やる気を挫く、混乱する) 
    させ、奇妙で理解しにくいコードを書かせるようにしてしまったのです。そして OOP コードベ
    ースの文脈では、命令型プログラミング (imperative programming) に対してはわずかな利益し
    か与えられません。わたしは自分が、一般論として Haskell や Python のような言語を学ぶ
    better プログラマーであるということに疑いを持っていません。しかし私が現在置かれている
    状況においてはわたしは better software developer ではありません。-- my productivity 
    has in fact nose-dived.わたしの productivity は nose-dived してしまいました。わたしが
    自分の書いた C#のコードに不満を覚えていたとき、わたしはそれを、自分のやる気を無くすた
    めだけの pointless exercise として自分自身にそれらの言語がいかに素晴らしいかを 
    demonstrate するためにHaskell や Python で書き直してみました。
    
    The moral of the story: don't bother improving yourself, unless you have the freedom 
    to improve your environment accordingly. That's rather depressing. Can anyone put a 
    better spin on this and cheer me up?
    
    The moral of the story:
    自分の置かれている環境を accordingly に improve できる
    自由をあなたが手に入れるまでは
    あなた自身を improving させることに飽きてはいけません
    それはとてもがっかりさせられることです。
    Can anyone put a better spin on this and cheer me up?
    
    Update: I probably should have made it more obvious for some people that the title of 
    the post is not entirely serious, and mainly I'm just griping.
    
    更新:
    I probably should have made it more obvious for some people that the title of 
    the post is not entirely serious, and mainly I'm just griping.
    
    

    2009年11月20日

    ■_

    ・Haskellな夜
    ということでいってまいりました。Haskellナイト。 アクセスマップを見ていて気がついたんですが、 お台場ガンダムのあった潮風公園からも割と近いっちゃあ近い位置だったんですね。 アクセスマップ TOKYO CULTURE CULTURE:@nifty

    まとめを書いている余裕がナッシング。

    
    
    
    すぺさるどりんくその1
    
    すぺさるどりんくその2
    
    
    座談会の参加者の方々。
    
    
    Programming in Haskell の著者からのメッセージ。
    来年4月に来日の予定があるとか
    (それにあわせてまたなにかイベントをやるかも?)。
    
    会場の参加者対して「Haskellで練習問題以上のものを作ったことのある人?」
    向井さん Haskell一時期使ってたけど飽きた?
    RWH 日本語になるだけでも価値がある
    720ページで3800円。あまりない値段付け
    原書は50ドルくらい?
    タイムインターメディアに感謝
    原著者に50箇所間違いを指摘した
    (反応はすぐに返ってくることも時間がかかることも)
    掲載されているプログラムはそのまま実行できるはず
    ただし本で想定しているのが GHC 6.8.3、現行の最新が 6.10.4 なのでコンパイルエラーになるものが
    316ページ
    366ページ
    世界で一番わかりにくい再帰の説明
    筆者が複数のせいか記述がころころ変わったりすることも
      末尾再帰
    
    Programming in Haskell
    10%ルールで輪講しました
    訳したら大学で使ってもらえるかも
    「またHaskell本か」(RWHもオライリー→オーム社)
    RWHの値段の情報が流れてきて再考
    かなりがんばりました
    通常なら考えられない値段
    720ページ以上の内容が詰まってます
    キーボードに刻印されていない記号使ってます
    13章がわからないという声が
    「RWHは好きなところを好きな順序で」
    「Programming in Haskellは頭から順に」
    Arc Challenge
    Lisp
    関数合成
    setq なしでプログラムを組めるのか?
    モナド
    なぜモナドは難しいのか
    暗闇の中
    群盲象を撫でる
    
    >>= は
    
    理解不能な概念を放っておけない
    
    
    
    

    座談会で cut-sea さんが、Programming in Hsakell の原書の値段を見たら 一万円超えていてびっくりしたという話をされたんですけど、それって ハードカバーのやつじゃないかなあ(ジュンク堂にずっと置いてあるしw)。 ペーパーバックのほうは一万円超えたことはないと思うけど。

    ■_

    関数型プログラミング言語Haskell Part11 
    
    228 デフォルトの名無しさん [sage] 2009/11/18(水) 05:09:15 ID: Be:
        Cで書かれたHaskellの1000行程度の小さい処理系ってないのか
        無いなら作る魂発揮できれば良いんだけど 
    
    229 デフォルトの名無しさん [sage] 2009/11/18(水) 07:57:41 ID: Be:
        schemeでも2000行程は掛かるから、
        演算子が色々あるhaskellはその十数倍は見積もらないと。
        haskellの最小コア命令セットってどうなるんだろ?
        schemeだとapply evalに、if set! define lambda beginだったか。(マクロもあるけど) 
    
    230 デフォルトの名無しさん [sage] 2009/11/18(水) 08:34:14 ID: Be:
        >>228
        Haskellの教育向け実装処理系であるGoferはいかが?
        ソースの合計行数(wc -l *.[chy])は、27110行だった。
        作者によるユーザガイドと実装に関する論文も公開されている(ただし英語)。 
    
    231 デフォルトの名無しさん [sage] 2009/11/18(水) 12:17:32 ID: Be:
        >>228
        作れるの? 
    
    235 デフォルトの名無しさん [sage] 2009/11/18(水) 16:38:15 ID: Be:
        いっそhaskell--とか言うサブセットでも定義して実装するとか
        なんか色々なものがclassで実装出来そうな気がする
        つまり標準的な仕様から除外出来そうな。互換性には目を瞑るって事で 
    
    236 デフォルトの名無しさん [sage] 2009/11/18(水) 17:42:21 ID: Be:
        >>235
        良く分からんけどがんばれ 
    
    

    C で書くというのはまあ大変だろうけど、「最小限の実装」ってどのくらいで 実装できるもんなんだろう(「最小」の定義があれか)。

    ■_ FizzBuzz ともなど

    http://debasishg.blogspot.com/2009/01/fizzbuzz-and-state-monad.html
    Ruminations of a Programmer: Fizzbuzz and the State Monad
    
    Fizzbuzz and the State Monad
    
    When I want to learn something I tend to look for examples that articulate the theme 
    of the problem directly instead of making it accidentally complex. Simple examples 
    make things easier, and I was searching for such an exmaple for understanding the 
    State Monad in Haskell.
    
    わたしが何かを学びたいと望んだときに単純な例はものごとを易しくするので、わたしは 
    Haskell の State Monad を理解するためのそういった例を探そうと思いました。
    
    The State monad is useful for modeling computations in Haskell that maintain state, 
    the bread and butter of programming in an imperative language. Haskell tutorials for 
    beginners teach us how to pass on the old value of the state with each call of the 
    function, and then extract the new state from the result. Commonly referred to as 
    "threading the state through the computation", this strategy works, but tedius .. and 
    Haskellers will consider this .. boilerplate.
    
    State モナドは Haskell で命令型言語でのプログラミングのパンとバター (the bread and 
    butter)である「状態」を取り扱うような modeling computations に有用です。ビギナー向けの 
    Haskell チュートリアルは関数の呼出しごとに state の古い値をどのように渡すかそして新し
    い state  をその結果から extract するのかを教えています。この strategy works は一般に
    "threading the state through the computation",とされていますが、tedius (tedious 退屈?) 
    であり、Haskell 使いはこれを boilerplate と見なすのです。
    
    the bread and butter: 非常に重要なこと、もの。飯の種。
    boilerplate: 良くあるパターンの文。とか。
    
    The State monad raises the level of abstraction and decouples the state management 
    from the computation itself. I am not going to write yet another tutorial on monads. 
    Instead I would like to share the example problem which made me understand the State 
    monad quite beautifully.
    
    State モナドは抽象化のレベルを引き上げ (raises the level of abstraction)、computation 
    そのものから状態管理を分離します。わたしはモナドについてのyet another なチュートリアル
    を書こうとは思っていません。その代わりに、わたしに State モナドをとても美しく理解させ
    た問題の例を共有したいと考えているのです。
    
    It is fizzbuzz !! Fizzbuzz has been solved in a multitude of languages of various 
    paradigms. The basic problem that fizzbuzz solves is simple enough to be moulded into 
    demonstrating various idioms of a programming language. Not all of them are efficient 
    or elegant enough, but serves well articulating the idiom in hand - you don't have to 
    stretch yourselves to comprehend the problem that you are trying to solve. You can 
    focus on the solution itself right from the word go. Even Haskell has quite a few 
    solutions to the fizzbuzz problem, but I could not find one that makes use of the 
    State monad. The solution below generates the whole fizzbuzz sequence as a side-effect 
    using monads. This is not the most elegant of solutions for fizzbuzz, does not work 
    for infinite sequences, but I found it quite simple and useful in understanding the 
    State monad in Haskell ..
    
    それが fizzbuzz です!! fizzbuzz が解決した基本的な問題とは、プログラミング言語の様々な
    イディオムをデモンストレーションするための型として十分すぎるほど単純なものです。そのす
    べてが十分に効率的 (efficient) でエレガント (elegant) というわけではありませんがbut 
    serves well articulating the idiom in hand -あなたが解こうとしている問題を compprehend 
    するために自分自身を stretch する必要はありません。You can focus on the solution 
    itself right from the word go. Haskell でさえ fizzbuzz 問題を解く方法はいくつもありま
    すが、わたしは State モナドを使ったものを見つけることができませんでした。以下に挙げた
    解法では fizzbuzz sequence 全体を藻などを使った副作用として生成しています。これは 
    fizzbuzz の解法としては most elegant なものではありませんしinfinite seqences にも対応
    していませんが、わたしが Haskell の State モナドを理解するのにとてもシンプルで有用なも
    のでした。
    
    Without further ado ..
    
    import Monad
    import Control.Monad.State
    
    -- the entire fizzbuzz list is prepared as a side-effect
    -- collect prepares the list as the State
    -- mapM strips the values part
    
    run_fizzbuzz :: [Integer] -> [[Char]]
    run_fizzbuzz list =
        state where (_, state) = runState (do mapM_ collect list) []
    
    collect :: Integer -> State [[Char]] ()
    
    -- gets the old state and cons s the new
    collect n = do
        f <- get
        put ((fizzbuzz n):f)
    
    fizzbuzz :: Integer -> [Char]
    fizzbuzz n
        | n `rem` 3 == 0 && n `rem` 5 == 0   = "fizzbuzz"
        | n `rem` 3 == 0                     = "fizz"
        | n `rem` 5 == 0                     = "buzz"
        | otherwise                          = show n
    
    main :: IO ()
    main = do putStr $ show $ reverse $ run_fizzbuzz [1..100]
    
    Posted by Debasish at 1/18/2009 07:52:00 PM
    
    

    ■_


    過去の雑記帖

    1. 2009年11月(下旬)
    2. 2009年11月(中旬)
    3. 2009年11月(上旬)
    4. 2009年10月(下旬)
    5. 2009年10月(中旬)
    6. 2009年10月(上旬)
    7. 2009年9月(下旬)
    8. 2009年9月(中旬)
    9. 2009年9月(上旬)
    10. 2009年8月(下旬)
    11. 2009年8月(中旬)
    12. 2009年8月(上旬)
    13. 2009年7月(下旬)
    14. 2009年7月(中旬)
    15. 2009年7月(上旬)
    16. 2009年6月(下旬)
    17. 2009年6月(中旬)
    18. 2009年6月(上旬)
    19. 2009年5月(上旬)
    20. 2009年5月(中旬)
    21. 2009年5月(下旬)
    22. 2009年4月(上旬)
    23. 2009年4月(中旬)
    24. 2009年4月(下旬)
    25. 2009年3月(上旬)
    26. 2009年3月(中旬)
    27. 2009年3月(下旬)
    28. 2009年2月(下旬)
    29. 2009年2月(中旬)
    30. 2009年2月(上旬)
    31. 2009年1月(上旬)
    32. 2009年1月(中旬)
    33. 2009年1月(下旬)
    1. 2008年
    2. 2007年
    3. さらに前
    この文書の無断転載はご遠慮ください(リンクはご自由にどうぞ)。

    メールの宛先はこちらkbk AT kt DOT rim DOT or DOT jp