ときどきの雑記帖 再起編

最新ページへのリンク
目次ページへのリンク

一つ前へ 2012年3月(上旬)
一つ後へ 2012年3月(下旬)

ホームへ

2012年03月20日

■_

二ヶ月ぶり 泳ぐやる夫シアター やる夫で学ぶ第一次世界大戦  第二十六夜「アメリカ参戦」

Go
The Way to Go: A Thorough Introduction to the Go Programming Language eBook 買ってみようかなあと思ったけど Format: Adobe Encrypted (DRM) でその気が失せたw

TOKYO MX アニメ総合スレ 26

547 メロン名無しさん [sage] 2012/03/19(月) 14:36:33.61 ID:???0 Be:
    >>539
    GAと略すといまだに、GA芸術科アートデザインクラス、
    ギャラクシーエンジェルかで一瞬迷う。 

■_ ~曲線

ゴンペルツ曲線も最近良く目にするんですが

山浦恒央の“くみこみ”な話(15):最もタチの悪いバグが潜むテストフェイズとは? - @IT MONOist

人口増加や病原菌の繁殖など、何かが増えたり大きくなったりする場合、図1に挙げるS字カーブを描く
といわれています。

Gompertz Curve(ゴンペルツ曲線) 図1 Gompertz Curve(ゴンペルツ曲線)

 この成長曲線にはいろいろなモデルや数式がありますが、代表格が「Gompertz Curve(ゴンペルツ
曲線)」でしょう。バグの発生数もこの曲線を描くといわれているため、ソフトウェア技術者には
非常に縁の深い曲線です。品質制御屋さんは、このS字曲線を眺めるだけで、ご飯が3杯食えるほど
元気が出るそうです。ソフトウェア・エンジニアリングの分野は、工学系では珍しく複雑な数式が
出てきませんが(そのため、世界的な傾向として、数学が苦手な理科系とナゾナゾが好きな文科系
が情報処理系に集まります)、唯一の例外がソフトウェアの信頼性関係でしょう。図1の下に書いた
式を見て頭が痛くなった人は、「(数学が苦手な)典型的なソフトウェア技術者」です。

なんか酷い言われよう

なんというか、品質保証のスライドやらドキュメントやら見てると 「撲滅」とか「摘出」とか使っている単語がえらく仰々しい気がするんですが。 これでプロジェクトを「総括」されたりした日には…

ところで @IT MONOistゼミナール・レポート:あなたは「バグ」をどう数えていますか? 組み込みソフトウェアの品質管理を考える (1/3) - @IT MONOist この記事は自分も疑問に思っていたことに踏み込んでて良いと思った。

■_ PowerShell

InfoQ なんですが

InfoQ: Script Explorer for Windows PowerShell

Script Explorer for Windows PowerShell

Posted by Jonathan Allen on Mar 19, 2012

Microsoft has released a beta of a new tool called Script Explorer for Windows PowerShell.
This tool is essentially a specialized search engine for PowerShell scripts. By default it
allows administrators to browse and search for scripts in TechNet Script Center and PoshCode.

PoshCode is a community run PowerShell Code Repository designed to server the same role as
Perl's CPAN or the Python Package Index. Scripts on PoshCode are offered under the Creative
Commons “No Rights Reserved” license unless otherwise specified. According to their terms
of use:

(以下略)

CPAN みたいなのができる。と。面白そう。

■_ SIMULA

Simula のなにが間違っていたか

INTRODUCTION TO SIMULA

WHAT IS WRONG WITH SIMULA ?

Simula never became a widely spread commonly used language. There are various reasons 
to explain this fact. Even though the reasons all depend on each other, the following 
is an attempt to group them from various ponts of view.

Simula は広く一般的に使われる言語とはなりませんでした。
それがなぜなのかはさまざまな理由があります。
それぞれが互いに依存してはいますが、以下にグループ分けしました。

Generally:

    Born in a small European country
    ヨーロッパの小国で生まれた

    Frozen in 1968

    Expensive
    高価だった

    Does not have a modern IDE
    modern なIDEがなかった

    Too complicated
    複雑すぎた

    Not enough publications
    publication が十分でなかった

Language features:

    Limited file access facilities (typed files)

    Missing data types (records, sets)
    record や set のようなデータ型がなかった

    No advanced parallelism and real time support
    高度な並列性やリアルタイムのサポートがなかった

    No GUI support
    GUI がなかった

    Long executable files for short programs
    小さいプログラムでも大きな実行ファイルになった(?)

OOP features:

    No multiple inheritance
    多重継承がない

    No interfaces
    継承がない

Simulation:

    No automatic collection of statistics
    No report generator
    No useful specialized facilities (resources) 

■_ ペアプロ

ちと疑問に思うところが

ペアプログラミングはとっても有益だ

だから、ぼくなんか、ペアプログラミング大歓迎だね!。

次に、いくつかの誤解を叩いておこう:

    ペアプログラミングは全時間的にやるべし: 不可能だよ。相方がトイレに行ってるときや、故郷
    (くに)に帰ってるときは、ぼくも仕事を休むのかい?。それはないよ。ペアプログラミングを
    できるかぎり勧奨するけど、でも、それが最適ではない状況ではやるべきでない。

    ペアプログラミングは集団思考に陥る: ちょいまち、集団思考の弊害云々は、もっと多人数の集
    団について言われていることだよ。たった2人のエンジニアでは、逆に、良質な会話が集団思考
    への傾斜を防いでくれる。The Mythical Man-Monthも言ってる: “いかなるシステムも3名以上
    の人間が設計してはならない”。つまり、船頭多くして船山に上(のぼ)るのは、船頭が3人以
    上のときだね。

    優秀なエンジニアをペアにすると、どちらも効率が落ちる: それは、ありえないね。

Guy Steeleが、あの超有名なRichard Stallmanとペアプログラミングしたときのことを、語っている:

“ある朝のことだった”、とSteeleは思い出を語る。“私がキーボードを使い、彼は私の横に座って
いた。彼はタイピングは完全に私にさせるつもりだったが、しかしまた、何をタイプするかはすべて
彼が指示した。

そのプログラミングセッションは10時間続いた。そのあいだずっと、二人は休憩せず、雑談もしなか
った。セッションの終わりごろになると、正しく書式化したそのソースコードは100行弱に達していた。
私はキーボードにずっと触れていた。でも二人のアイデアはむしろ、画面の上に流れていくようだっ
た。彼が私に何をタイプするか指示し、私はそれをタイプした”。

そのセッションの長さは、SteeleがAI Lab(MITの)をやっと出たときに分かった。545 Tech Square
の建物の外に出ると、驚いたことに、彼は夜の闇に包まれていた。Steeleもプログラマだから、マラ
ソンのようなプログラミングセッションには慣れていたが、そのときだけは、何かが違っていた。
Stallmanとペアで仕事をすると、Steeleはすべての外部的刺激を遮断せざるを得なくなり、彼のメン
タルなエネルギーのすべてを目の前のコードに注ぎ込んだ。Steeleによれば、Stallmanとのマインド
メルド(mind-meld)は、楽しいと同時に怖かった。“あとになって私はこう思った: すばらしい体
験だった、ものすごく濃密な時間だった、そしてそれは、私の人生において二度とやりたくないこと
だ”。

ペアプログラミングは、人と状況を選ぶ、と言えるだろう。

ペアプログラミングには、あまり話題にもならない腹違いの兄弟がいる。それは、横並びプログ
ラミング(side-by-side programming)だ。それには、各人の勤務時間のシフトをうまくやれば、
ペアプログラミングの利点の一部(すべてではない)がある。しかも各自が各自のマシンを使う
から、エゴの衝突も少ない。ナビゲータの目を必要としないルーチン的な仕事(モバイルアプリ
の汎用デザインの利用など)では、うちでもそれをよくやる。二人がそれぞれのポータブルなラ
ップトップを持ち寄って仕事を開始するが、互いに相手の画面を見ることはできる。

ペアプログラミングを勧めることを書いてきて、さらに例に出したものにしては 反面教師というかなんというか。 確かに「ペアプログラミングは、人と状況を選ぶ、と言えるだろう」と続いてはいるんですけど

Pair Programming Considered Extremely Beneficial | TechCrunch


I for one welcome our pair programming overlords!

Now, to dispel a few myths:

    Pair programming must happen 100% of the time: impossible. Do I stop typing because you
    go to the bathroom or you're at home sick? Of course not. That doesn't mean we don't
    encourage pairing as much as possible, because we do, and there are certainly times when
    pairing is less than optimal so we don't pair then.

    Pairing causes Groupthink: What? Groupthink happens when you have really large teams. If
    anything, pairing prevents groupthink, as each pair is only two engineers. Is two a large
    team? Go read The Mythical Man-Month. “No system should be architected by more than 2
    people”. Small teams don't cause groupthink, really big teams do.

    Pairing great engineers together makes them both ineffective: negatron.

Guy Steele on pairing with the legendary Richard Stallman:

“We sat down one morning,” recalls Steele. “I was at the keyboard, and he was at my elbow,”
says Steele. “He was perfectly willing to let me type, but he was also telling me what to type.

“The programming session lasted 10 hours. Throughout that entire time, Steele says, neither
he nor Stallman took a break or made any small talk. By the end of the session, they had
managed to hack the pretty print source code to just under 100 lines. “My fingers were on the
keyboard the whole time,” Steele recalls, “but it felt like both of our ideas were flowing
onto the screen. He told me what to type, and I typed it.”

The length of the session revealed itself when Steele finally left the AI Lab. Standing outside
the building at 545 Tech Square, he was surprised to find himself surrounded by nighttime
darkness. As a programmer, Steele was used to marathon coding sessions. Still, something about
this session was different. Working with Stallman had forced Steele to block out all external
stimuli and focus the entirety of his mental energies on the task at hand. Looking back, Steele
says he found the Stallman mind-meld both exhilarating and scary at the same time. “My first
thought afterward was: it was a great experience, very intense, and that I never wanted to do
it again in my life.”

Yes, pair programming isn't for everyone or every company.

But there's also pair programming's little-talked-about stepbrother: side-by-side programming.
You get some, but not all, of the positives of pairing (if your organization can't handle the
shift), but engineers can keep their egos and their own machines. We do this when we're working
on routine tasks that don't require a second set of eyes (e.g. inserting design assets into a
mobile application). We have floater laptops you can grab to do this, but both engineers can
see each others screens.

But there's also pair programming's little-talked-about stepbrother: の But が訳文に生きていないような気がするんだけど 気にしすぎでしょうか。 えいごむずかしい

■_ /

今回は2005年の記事で盛り上がり。 これとは別の、DOSのパス区切りの期限の話を読んだ覚えがあるんだけど どこだったかな(かなり詳しく書かれていたはず)。 Why is the DOS path character "\"? - Larry Osterman's WebLog - Site Home - MSDN Blogs 24 Jun 2005 6:15 PM

んでまあそれ自体はどうでもよくて。

Why is the DOS path character "\"? : programming

The / as the leading switch character came from DEC's PDP-11 operating system, RT-11. 
CP/M didn't invent that, they copied it from DEC. CP/M was an awfully lot like RT-11.

    The / as the leading switch character came from DEC's PDP-11 operating system

I'm not totally convinced. IBM VM CP/CMS came out in 1968 (before the PDP-11), and it used
slashes for lots of subcommands (not the same as switches, but they were words that had
meaning in the context of a command). For example, once FLIST (basically a file browser) was
launched, you could type "/H" for help.

I never used the IBM system, but I used RT-11 a lot in the 70's and CP/M looked like a 
workalike copy to me. / switches were how it worked.

    They couldn't use the *nix form of path separator of "/", because the "/"
    was being used for the switch character.

Was this before the advent of whitespace to separate atoms? (And quoting to isolate whitespace
within one?)

I'm still trying to figure out why you can't use the switch char as the path delimiter...
IIRC no spaces are allowed in DOS paths anyway.

What would "dir /p" mean? Would it mean, pass the p option to dir, or list the
contents of the p subdirectory?


Well, since Windows/DOS don't have a system root as *nix does, that would have to be an
option--to be a subdirectory, it would need to be just "p" or "./p").

couldn't it mean the p directory at the "root" of the current drive (i.e. probably C:\p)?


Right you are, my bad. Disregard my previous comment.

■_

■_

いろいろネタがあるんですけど仕込んでいる時間がががががが

2012年03月19日

■_

コメント欄が賑やか Island Life - 直交世界の地図

Compilers Reloaded - T3X.ORG のコンパイラー本を買ってみようかと思ったのだけど、言語の壁に阻まれた。

回答はこちら → The mystery of Duqu Framework solved - Securelist

■_ Why Systems Programmers Still Use C

例によってちょっと古い記事が取り上げられて…のパターンなんだけどまあ伸びる伸びる。 Why Systems Programmers Still Use C (2006) | Hacker News Why Systems Programmers Still Use C, and What to Do About It : programming Programming Language Challenges in Systems Codes 本の虫: なぜいまだにシステムプログラミングはCなのか

■_3 Things I hate about “beginner” programming books

初心者向けプログラミング本でキライなこと三つ。

All Fuzzy 3 Things I hate about “beginner” programming books

3 Things I hate about “beginner” programming books

1. Too long (長すぎる)

If your book claims to be a beginner's book on a programming language, and is 800 pages, you
are doing it wrong. Go back to your editor. Halve the book. I understand that by making the
book large, you can justify the expensive price tag, but it certainly doesn't help a beginner
programmer. I also understand that it is not easy to keep a programming book short. There are
many complex concepts and practices that require thorough bottom-up explanation. But that's a
tough job you as an author have to deal with. You think hard and decide what should be taught
and not taught to a beginner. Do not pass that burden over to a beginner and do not overwhelm
the reader with hefty material.

もしあなたの書く本がプログラミング言語の初心者向けだと主張するものであり、
かつ800ページあるのであれば、あなたは間違ったことをしています。
編集のところへ戻ってその本を半分に (havle the book) しましょう。
しかしそれは初心者プログラマーを助けたりすることはないのです。
わたしはプログラミングの本を短く納めることが簡単ではないことを理解しています。
多くの複雑なコンセプトがあるし、bottom-up explanation を行うことを要求する実践があります。
しかしそれは書き手として取り組まなければならない困難な仕事であるのです。
You think hard and decide what should be taught and not taught to a beginner.
Do not pass that burden over to a beginner and do not overwhelm the reader with hefty material.

Here's a book that's concise yet detailed. Eloquent Javascript by Marijn Haverbeke

2. Too many examples like “Hello World!”
   ("Hello, World!" レベルの例が多すぎる)

Ideally, “Hello World!”-like example should only appear once in your book. If your book
continues to fill examples with arbitrary useless examples like drawing Christmas Tree in
console, the reader will increasingly feel alienated from real practise. The readers are not
stupid. They know real programmers never draws Christmas Tree in console (unless it's for lulz).
So why force readers to plough through useless examples? If you are teaching string manipulation,
create an example about generating a .csv file. Don't make readers draw a Christmas Tree ever
again. Ruby on Rails Tutorial: Learn Rails by Example by Michael Hartl does an incredible job
teaching concepts in Ruby on Rails while building a usable product, leaving the reader feeling
accomplished. 

理想的には、“Hello World!”レベルの例は本にただ一度だけ現れるようにすべきです。
コンソールにクリスマスツリーを描かせるような arbitrary useless examples で
あなたの本が満たされているのなら、読者は real pracise からの乖離を感じはじめるでしょう。
読者は莫迦ではありません。彼らは本物のプログラマーがコンソールにクリスマスツリーを
描いたりはしないことを知っています。
なぜ読者にそんな役にも立たない例を押し付けるのでしょうか?
文字列操作を教えたいのなら、.csv ファイルを生成するような例を作りましょう。
二度と読者にクリスマスツリーを描かせてはいけません。
Michael Hartl による Ruby on Rails Tutorial: Learn Rails by Example は
有用な product を構築しながら Ruby on Rails におけるコンセプトを教えるという
すばらしい仕事を果たしています。


3. No answers to exercises. (演習問題の解答がない)

I believe that exercises are mandatory part of programming books. Programming books shouldn't
be just about reading. Ultimately programming books are there to teach readers to program.
Exercises are important because they encourage readers to think independently and actually
write programs.

わたしは演習問題がプログラミング本の大事な部分だと確信しています。
プログラミング本は単に読むだけのものであるべきではないのです。
結局のところプログラミング本はプログラムを読み手に教えるためにあるのです。
演習問題は読み手に independently に考えさせ、
また実際にプログラムを書かせるので重要です。


But what use are these exercises, if readers cannot find out what the answer is. It should
be expected that beginner programmers will be stuck in limbo very frequently. They will be
faced with problems the author could not even foresee. For this reason, author must provide
answers to the exercises as a fallback plan for readers. Without the answers, readers who are
stuck will simply have to give up on the problem without knowing what the solution is.


I know there are many publishers that have ties with university professors. They make deals
with professors to exclude answers to textbooks, so that professors can use these problems as
assignment and exam questions. If you are part of this scheme, go fuck yourself. You do not
stand for beginners trying to learn how to program.


反応 → 3 Things I hate about “beginner” programming books : programming

■_

2012年03月18日

■_

でるのねw Amazon.co.jp: 孤独のグルメ DVD-BOX: 松重豊: DVD

行きたいけど無理だろうなあいろいろと。 QCon Tokyo 2012 Conference|QCon 東京 2012 カンファレンス んでも Beauty is in The Eye of the Beholder なんか決まった言い回しなのかな? > The Eye of the Beholder Beholder って某テーブルトークRPGのあれですよね。

■_

ここんとこかなりgdgdになってますが、今週はさらにgdgd度が増します。 たぶん。

■_ スレッド探訪

関数電卓も奥が深いのねえ

関数電卓総合スレッドその2 [chaika]

2 Nanashi_et_al. [sage] 2011/12/14(水) 22:38:42.23 ID: Be:
    国内メーカー、海外メーカー問わず、関数電卓についてまったりと語り合うスレです。
    タイトルは関数電卓総合スレッドですが、ポケコンや Canon、Citizen、その他メーカーネタも可とします。
    また、煽り、粘着はスルー、AAのコピペは厳禁、とします。

    【Hewlett-Packard(海外)】
    HP Calculators(公式)
    http://www.shopping.hp.com/webapp/shopping/store_access.do?template_type=landing&landing=calculator&selectMenu=calculator
    hpcalc.org
    http://www.hpcalc.org/
    株式会社ジュライ
    http://www.july.co.jp/index.php?main_page=index&cPath=15

    【Texas Instruments(海外)】
    Texas Instruments(公式)
    http://education.ti.com/educationportal/sites/US/homePage/index.html
    ticalc.org
    http://www.ticalc.org/
    Naoco Inc.
    http://www.naoco.com/index.htm 

3 Nanashi_et_al. [sage] 2011/12/14(水) 22:39:12.57 ID: Be:
    【CASIO(海外)】
    CASIO WEW Worldwide Education Website(公式)
    https://edu.casio.com/
    casigo.de
    http://casigo.patrickleibold.de/
    Casio Kingdom
    http://casiokingdom.org/
    Universal Casio Network
    http://casiokingdom.org/

    【CASIO(国内)】
    電卓 - CASIO(公式)
    http://casio.jp/dentaku/

    【SHARP】
    電卓:シャープ
    http://www.sharp.co.jp/calc/

    【その他】
    関数電卓マニアの部屋:http://teamcoil.sp.u-tokai.ac.jp/calculator/index.html
    ポケコン:http://www004.upp.so-net.ne.jp/upc/pc/index.html 

362 Nanashi_et_al. [sage] 2012/03/14(水) 22:02:43.31 ID: Be:
    そういや昔CITIZENの電卓買ったっけなあと思って掘り出してみたらSRP-280だった
    これ精度すごくいいんだな
    びっくりしたよ 

364 Nanashi_et_al. [sage] 2012/03/15(木) 03:09:47.21 ID: Be:
    >>362
    それ(SRP-280) で radian モードで tan(355) っていくつになる? 

365 Nanashi_et_al. [sage] 2012/03/15(木) 18:16:19.55 ID: Be:
    tan(355/226)ね
    -7497258.185 

366 Nanashi_et_al. [sage] 2012/03/15(木) 22:50:35.29 ID: Be:
    オレ愛用のMicrosoft電卓では-7497258.1853255871129050718318912 

367 Nanashi_et_al. [sage] 2012/03/15(木) 23:07:17.51 ID: Be:
    ぐぐるだと
    tan(355 / 226) = -7 497 258.19 

368 Nanashi_et_al. [sage] 2012/03/16(金) 01:56:03.85 ID: Be:
    hp15cLEでは

    tan(355 / 226) = -7,507,225.71 

369 Nanashi_et_al. [sage] 2012/03/16(金) 22:36:55.68 ID: Be:
    一方その頃 Casio fx-9860GII SD では
    Tan(355/226)= -7497258.44
    となり、TexasのTI-84では
    Tan(355/226)= -7497257.878
    となるのであった 

370 Nanashi_et_al. [sage] 2012/03/16(金) 22:39:15.88 ID: Be:
    なんで皆違うのはなんでなんだぜ? 

371 Nanashi_et_al. [] 2012/03/16(金) 23:13:42.85 ID: Be:
    自分のcasio電卓は三機とも-7497258.44になった

372 Nanashi_et_al. [sage] 2012/03/17(土) 00:06:28.82 ID: Be:
    http://www.voidware.com/calcs/torture_trigs.htm 

373 Nanashi_et_al. [sage] 2012/03/17(土) 00:16:54.54 ID: Be:
    SRP-285N
    tan(355/226)= -7497258.185
    同じだね

    TI-36X pro
    tan(355/226)= -7497263.499
    あれ?

374 Nanashi_et_al. [sage] 2012/03/17(土) 00:35:51.63 ID: Be:
    >>373
    ゴキブリはそんなものじゃないのかな。

    >372を見ると、やっぱりSRP-280/285は精度が高いんだということがよくわかる。 

379 Nanashi_et_al. [sage] 2012/03/17(土) 07:13:19.11 ID: Be:
    オレ愛用のPowerToy Calculatorだと
    -7497258.18532558711290507183189124866341726794378526316157122347015183788495623895712818696822
    81839570540842373435690910553052445455153472624382218554829076525285062727056734876168111349802
    79133475661301410255191249217499447722687260056555403705290475378240439343730184904011792643259
    13796347258380293316589855251709025559167412482788237330747371603605011205762036891592840622872
    97836032627164233592975434880261086714690786736215626346297269405212316637915495578075040382811
    93756274313599297719239960510914320064

    http://go.microsoft.com/fwlink/?LinkId=211474 

380 Nanashi_et_al. [sage] 2012/03/17(土) 09:23:10.66 ID: Be:
    オリジナルの出来も気になったのでいろいろ試してみた
    TI-30XIIS
    -7497263.499
    思ったほど大したことなかった

    VICTOR V34 (TI-30XIISのコピー品)
    -7497258.44
    コピーのほうがマシ?

    TI-30XA
    -7497092.473

    TI-36X SOLAR
    -7497092.473
    標準電卓はどちらも同じか

    CANON F-718SA
    -7497258.185
    内部精度18桁はマジだった

    CANON F-788dx
    -7497258.159

    CANON F-766S
    -7497258.159

    CANON F-715S
    -7497258.159
    このへんもわりといい感じ

381 Nanashi_et_al. [sage] 2012/03/17(土) 09:26:22.73 ID: Be:
    おまけ

    CANON F-502G
    -7497100.496
    標準電卓は中間結果が出てしまうので精度的に仕方ないのかな

    SHARP EL-5160J
    -7497264.149

    SHARP EL-501J
    -7497094.876

    SHARPとCANONは全く同じというわけではなかったんだ

385 Nanashi_et_al. [sage] 2012/03/17(土) 10:16:09.21 ID: Be:
    -7497258.185325587112905071831891...
    どれもコマンドがバラバラ過ぎる...

    Mathematica: N[Tan[355/226], 100]
    Maple: evalf[100](tan(355/226))
    MuPAD: DIGITS := 100:float(tan(355/226))
    Mathcad: tan(355/226) float,100 →
    wxMaxima: set_display('none)$fpprec:100$bfloat(tan(355/226));
    Xcas: evalf(tan(355/226),100)
    reduce: precision 100$ON ROUNDED$tan(355/226);
    FriCAS: digits(100);numeric(tan(355/226)) 

390 Nanashi_et_al. [sage] 2012/03/17(土) 22:34:49.87 ID: Be:
    おまけ
    Yacas: N(Tan(355/226),100)
    MathPiperIDE: N(Tan(355/226),100)
    SymPy: from sympy import *;tan(Rational(355,226)).evalf(100)
    sympycore: from sympycore import *;print tan('355/226').evalf(100) 

395 Nanashi_et_al. [sage] 2012/03/18(日) 16:19:32.96 ID: Be:
    fx-CG20-N 買ってきた。ビックで24800だったからほとんど定価。
    これから買おうと思っている人にアドバイス、
    並行輸入が利用できるならそっちの方がいいぞ。
    日本語はパッケージとマニュアルだけだ、本体には表示されない。

    本体の印象は、デカイ。TI-89Tと同じかちょっと幅が広い、厚みは同じくらい(約20ミリ)
    単4×4本
    バックライト液晶、色はあまり綺麗じゃないというか鮮やかじゃない、65536色だからそんなものか。
    デザインが今までのCASIO風とちょっと違う、巨大なBlackBerryみたいな。
    PC接続用のUSBケーブルと同一機種接続用のケーブル(ステレオミニプラグみたいなやつ)同梱
    CG20以外に9860や9750シリーズなんかともデータ転送できるらしい。
    紙のマニュアルはスタートアップガイド(日本語)が14ページくらい、あとは同梱のCDにPDF読め、各国語あり。
    PC接続用のアプリなんかも入ってる。

    計算機としてはまだよく使ってないのでわからんが、
    普通の計算モードなんかはTI-89に似ている気がする。
    tan(355/226) = -7497258.44
    この結果はCASIOはみんな一緒だな。

関数電卓は4台ほど使ってきたかなあ。 最近、HPの復刻版のアレを買ったけどまだ箱から出してもいないw

■_

■_ なんだこれ

The C Conference

The C Conference
Hello World! 

Mar 17 2012 

Let's do this thing! We are contacting organizers for sections of the conference and 
starting to search for a location and funding. 

Some conference ideas: 

  C compiler implementers panel (clang, gcc, icc) 
  libc implementors panel (glibc, uclibc, bionic libc) 
  Hardening code with compilers and tools 
  Exploiting modern C code bases 
  Implementing Kernels in C (BSD, Linux, etc) 
  Cross platform libraries and porting platforms 
  CCAN the C Code Archive 
  Discussion of build systems and the future of shared libraries (gyp, autoconf) 
  Building smart modern library APIs (libabc) 
  A Hack Day that lasts three days (hey, C development takes time) 

icc や libc の implementers の話というのは興味ある :)

The C Conference | Hacker News

2012年03月17日

■_

OSC
行けなかったのですが、ひょっとして会場で例の本が買えたりした? USP友の会:今週金土はオープンソースカンファレンス。発表・ブース展示やるよ---その2 オープンソースカンファレンス2012 Tokyo/Spring - オープンソースの文化祭!

最近
データの「可視化」あたりも興味があったり。 というか仕事で必要になったというかなんというか hirax.net::「下水普及率」と「トイレ水洗化率」を楽しくグラフで眺めてみよう!?

被った
某読書会と日程被った○| ̄|_ PFDS読書会 第6回 (Purely Functional Data Structures) - [PARTAKE]

■_ Lisp Hackers: Zach Beane

Java Hero ってがありましたが、その類似企画?

Lisp, the Universe and Everything: Lisp Hackers: Zach Beane

Lisp Hackers: Zach Beane

I'm starting a series of interviews with lispers, who inspire me. Lisp community includes a
lot of amazing programmers, who's thoughts, I believe, deserve more prominence and recognition,
than they usually enjoy. Besides, unlike many other languages, lisp users span several
generations of programmers: there are a lot of people, who'd made great contributions, but
have since moved on. I hope to have some of them in this series as well.

And the candidate for the first interview was obvious to me. Zach Beane is the uniting link of
the whole community. The creator of Quicklisp and a number of useful open-source libraries,
like Vecto and ZS3, he is also always active on #lisp irc channel answering questions, as well
as keeping a blog, where he shares interesting Lisp news, and supporting Planet Lisp blog
aggregator. And that's not all...

(略)

What brought you to Lisp? What holds you?
    Paul Graham's Beating the Averages describes a really exciting way to use an uncommon tool
    to great advantage. That got me interested in how I could do the same thing. I started off
    with some stuff in Scheme because I thought CL was old and crufty and gross, but when I
    started using SBCL I found it was a great, practical tool, and I never stopped using CL
    after that.

    I continue to use CL because it has a great mix of features (object system, first-class
    functions, fast compiled code, multiple implementations, a fantastic standard, etc, etc)
    and it works well in my favorite working environment, Emacs on Linux. I feel like I know
    it well and I can see quickly how to use it to explore and solve new problems.

(略)

What you dislike the most about Lisp?
    There are a lot of negative perceptions about Common Lisp that are reinforced by current
    and former Common Lisp users. I can accept that CL is not for everyone, but some of the
    criticism is just years (sometimes decades) of moaning and nitpicking about decisions made
    in the distant past that are not really up for review right now. I wish the people who are
    vocally, chronically dissatisfied with CL would go off and do their own thing and stop
    bothering people that are happy with Common Lisp.

    There are some remarkable trolls that like to pick on CL, but they're not usually taken
    seriously by anyone, but "insiders" who complain about CL are perceived to be
    giving some sort of genuine insight. It's very annoying.

(略)
Anything else?
    Common Lisp is a great system that rewards in-depth study.
    (Common Lisp は深く学ぶ価値のある great なシステムです)

P.S. Xach gave a talk about Quicklisp at the last ECLM, and I think his motto for Lisp 
development, he presented there, is really worth sharing and following :)

■_ Lisp Hackers: Edi Weitz

ふたりめ

Lisp, the Universe and Everything: Lisp Hackers: Edi Weitz

Lisp Hackers: Edi Weitz

(略)

What brought you to Lisp? What holds you?
    I came to Lisp via Emacs Lisp in 1999 or so. What got me hooked was the wonderful book
    "Writing GNU Emacs Extensions" by Bob Glickstein. It opened my mind for the
    beauty of the Lisp language family — something I had missed the first time I had
    encountered Lisp (in university, a few years earlier). The two CL books by Paul Graham 
    and Norvig's PAIP then paved the way for Common Lisp.

    1999年頃に Emacs Lisp を通じて Lisp に触れました。
    わたしをひきつけたのは Bob Glickstein による "Writing GNU Emacs Extensions"
    というすばらしい本でした。


    What holds me is that I haven't found a better programming language so far — and I don't
    expect to find one very soon.

    わたしを捉えたものは、これよりも優れたプログラミング言語が見つからなかったからです。
    そんなものがすぐに見つかるとは期待していません。

(略)

What you dislike the most about Lisp?
    There's nothing I really dislike about Common Lisp. There are a few warts here and there,
    but so far I've found nothing that was serious enough to prevent me from being productive.

    Common Lisp にはわたしが本当に嫌いだと思うような点はありません。
    そこここにいくつかの wart (こぶ) はありますが、わたしが productive であることを
    阻害するほど深刻なものはないのです。

■_ Practical Compiler Construction

どんな感じの本なんだろう Compilers Reloaded - T3X.ORG

My latest book: Practical Compiler Construction by Nils M Holm : programming

My latest book: Practical Compiler Construction by Nils M Holm (t3x.org)


UPDATE: Because the preview at Lulu.com requires Flash, I have added a preview in PDF format
to the book page. Enjoy!

If you liked Scheme 9 from Empty Space then this book may interest you. It is basically the
same approach, but discusses a C compiler instead of a Scheme interpreter.

The book is in handy 6"x9" format (in case you prefer a paperback book), but also
available as a PDF. The complete source code from the book is in the public domain.

Review copies (PDF) are available for bloggers and editors. Just contact me via my homepage:
www.t3x.org.


Any chance / way you would consider doing a deal for buying both books? I've been meaning to
get the Scheme 9 for a bit now, but haven't gotten around to it. So I'm wondering which one
I should buy (I would buy both, but not necessarily for $60). Thanks!


Sure. Mail me and we will work out a deal.


The target audience for this book isn't very clear from the book description. What kind of
expertise is expected?


Being fluent in an imperative programming language is essential for reading the book. Some
familiarity with C would be a great plus. No compiler-writing background is necessary.

Ah. I think you should update this on your site or at least in the book preview lest 
"compiler" in the title scares the beginners away.

Hi, can you explain a little what is in the parsing section? Does it provide an 
overview of the grammar types and their relative power/complexity?

The parsing chapters discuss neither grammar classes (Chomsky hierarchy, etc.) nor the power
of the various parsing techniques (LL, LR, LALR).

They basically introduce grammars and BNF in general and then explain how to turn a grammar
into an actual recursive descent (RD) parser. They do cover ambiguity (LL(k) with k>1),
though.

The chapter on expression parsing contains a nice (IMO) explanation of "falling 
precedence parsing", which is a technique that eliminates recursion from RD 
parsers.

As the title suggests, the book focuses on practial aspects of compiler writing, and I 
felt that grammar classes were a bit too far on the theoretical side.

I hope this answers your question.

practical に。か。

■_ 脱線

このスレは相変わらずだ

【ナポレオン】長谷川哲也35【陣借り平助】

134 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 14:38:34.27 ID:NMyNKwAv0 Be:
    チンギンスハーンの研究する人って少ないね
    世界史上一番の英雄だろうに 

135 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 14:58:12.49 ID:dN2THDL9O Be:
    >>134
    チンギス・ハーンの研究はリデル・ハートが一次大戦直後に。
    特に配下のスブタイを絶賛してる。
    これは後の電撃戦のヒントとも言える感じのもので、グーデリアンやマンシュタイン等の名将が尊敬する名将の一人にスブタイの名前を挙げているほど。 

141 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 20:10:08.71 ID:zJJVDPT/0 Be:
    チンギスに限らずあの辺は古代~中世まで経済的にもアジアの一大勢力圏だったんだから
    研究したい人はいるんだろうけど、史料でつまづぎやすいのかもねぇ

    コンビニに雑誌あったから、最後だしと久々に陣借り読んでみたら、
    まったく陣借りてねえ(´・ω・`)
    中味からすると、やっぱりアイゼンファウストの続きも描きたいのかな… 

142 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 20:41:22.62 ID:NMyNKwAv0 Be:
    陣借りは、日本の戦国時代に転生した(ネイ+ミュラ)÷2の物語だと思ってる 

143 忍法帖【Lv=40,xxxPT】 [sage] 2012/03/15(木) 20:43:11.59 ID:a5mqF3U20 Be:
    >>142
    モローも出て来るしな 

144 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 22:02:55.52 ID:qfDHa4zg0 Be:
    あの当時のモンゴル軍団は
    いかなる理由からか生水厳禁、水は湧かして飲めという方針だったと
    昔の豆知識コーナーで知ったが

    それが本当なら、衛生面についてもかなりのものだと思う。


    そういえば、ナポレオンではメガネをかけた同じような顔をした男が軍医でいるが
    あれが後の四肢切断神速ラリイ軍医なんだろうか。 

145 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 22:06:53.85 ID:ugR6k/Hi0 Be:
    固形物を全く食べないで10日間馬の乳と血だけで生き延びれたとか
    さすが遊牧民族 

146 名無しんぼ@お腹いっぱい [sage] 2012/03/15(木) 23:16:29.86 ID:QRqzgRzR0 Be:
    なんだかんだ言って血液は栄養豊富な訳で
    乳も血液からできてるし、人間水分あったら何とか生きれるしねぇ 

147 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 07:11:18.15 ID:bWlbTl9B0 Be:
    砂漠で動物の血は貴重な水分だって元SASの人が言ってた 

149 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 16:45:27.47 ID:xp5J5PxE0 Be:
    >>147
    なにその砂漠のカーリマン 

150 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 17:53:05.24 ID:YN4nnleQO Be:
    そういえばキートンさんまた始まるんだっけか 

151 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 17:56:06.43 ID:Oz60NjjM0 Be:
    マジ?kwsk 

152 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 17:59:32.35 ID:Eyw4ZJCV0 Be:
    3月19日発売の「ビッグコミック オリジナル」に掲載
    20年後のキートンだと 

157 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 23:09:47.00 ID:dt5GOT5R0 Be:
    浦沢直樹版「ナポレオン」



    絶対中途半端で完結 

158 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 23:15:05.69 ID:lLcJ7xqY0 Be:
    合間合間に入るドイツでのオリジナルストーリーだけイキイキしてる 

159 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 23:32:16.42 ID:ewT4k6F50 Be:
    江川達也著 ナポレオン戦争物語 

160 名無しんぼ@お腹いっぱい [sage] 2012/03/16(金) 23:46:56.90 ID:/+TvlrhO0 Be:
    宮下英樹 コンスル 

161 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 00:03:43.46 ID:Sgvg74wN0 Be:
    美内すずえ はるかなる風と光 

162 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 14:35:06.82 ID:QaPqRWeo0 Be:
    岩明版ナポレオンは書記官が主人公ってことか・・ 

163 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 14:56:03.65 ID:9fZ6y49o0 Be:
    それより老若男女ギョロ目が売りだろうとw 

164 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 18:51:14.00 ID:aiS5FG0H0 Be:
    >>162
    ブーリエンヌが実はスキタイ人

    ジョゼフィーヌ「だまれ」 

165 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 19:06:56.70 ID:gkfkLrUP0 Be:
    ギロチンで落された首が、えんえんと描かれ続ける 

166 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 19:24:28.65 ID:ktrKpOh10 Be:
    ヴィクトールがサーベルで両断した敵兵の断面が詳細に 

167 名無しんぼ@お腹いっぱい [sage] 2012/03/17(土) 20:10:29.93 ID:lWBJKY3e0 Be:
    ダヴー、ぼ、防御たのむ… 

そいやキートン。毎号掲載じゃないのね(月一ですらなかった)。

■_ R

えー、なんか最近上げたばかりな気がするんだけどなあ○| ̄|_

【R言語】統計解析フリーソフトR 第4章【GNU R】

428 132人目の素数さん [sage] 2012/03/13(火) 00:08:39.50 ID: Be:
    http://www.r-project.org/
    R 2.15.0 prerelease versions are currently available. Final release is scheduled for March 30. 

■_

2012年03月16日

■_

新しい iPad を早速買っている人が わたしの twitter の TL に多くていろいろと(省略されました)

■_ private

Matz answers why Ruby lets sub classes to access private methods in super class : programmingA programmer in Japan: Matz answers why Ruby lets sub classes to access private methods in super classJavaやC#の常識が通用しないRubyのprivateメソッド - ITは芸術だ と。reddit にも本人が投稿してたのかしらん。

Matz answers why Ruby lets sub classes to access private methods in super class : programming

Matz answers why Ruby lets sub classes to access private methods in super class 
(junichiito.blogspot.com)


Well, the real gist is, such keywords are meaningless. In fact, he mentions Smalltalk without
actually understanding it: in Smalltalk, there is no formal syntax for 'private'. There's
only convention (ie, if something is in a private category, don't call it).

Ruby picks a bizarre middleground, where it both has a private keyword, but also doesn't
really enforce it in a useful way. Personally, I'd rather it either not have the keyword at
all, or have it and enforce it in a more "traditional" fashion, than the current
half-assed implementation.

That said, it's hardly a disaster. Just peculiar.


fwiw python's approach is to not have any keyword but instead have the convention of naming
the "private" attributes starting with an underscore.

i actually find ruby's semantics of "private" make perfect sense in the context of
message-passing OOP. you cannot send a private method call as a message to an object, but you
can call those methods from other methods in the same class or from a subclass, because
they're essentially being sent by self.


Then, using more "standard" (read, C++-like) semantics, those methods are protected,
not private. And Ruby's "protected" semantics are just weird...


pretty much, yes. i've actually never had occasion to use protected in ruby.


Rich Hickey has some interesting thoughts on the topic of private variables:

At some point though, someone is going to need to have access to the data. And if you have
a notion of “private”, you need corresponding notions of privilege and trust. And that
adds a whole ton of complexity and little value, creates rigidity in a system, and often
forces things to live in places they shouldn't... So, it's a risk management decision, one
I think programmers should be free to make. If people don't have the sensibilities to desire
to program to abstractions and to be wary of marrying implementation details, then they are
never going to be good programmers.

That's a nice article, thanks.

If it's not posted on proggit yet, you should submit it.

■_ 空

C言語なら俺に聞け(入門編)Part 99 

173 はちみつ餃子 ◆8X2XSCHEME [sage] 2012/03/16(金) 13:26:58.48 ID: Be:
    俺、「空ポインタ」を「からポインタ」って読んでたわ。
    JIS の索引の順番を見ると「くうポインタ」なんだな orz
    ルビ振っといてくれりゃいいのに。 

176 デフォルトの名無しさん [sage] 2012/03/16(金) 13:37:04.95 ID: Be:
    >>173 「あきぽいんた」と思ってた 

232 デフォルトの名無しさん [sage] 2012/03/16(金) 20:02:20.47 ID: Be:
    >>173
    いつもぬるぽいんたって読んでたわ…
    もしかして空文字列もくうもじれつなのかな 

233 デフォルトの名無しさん [sage] 2012/03/16(金) 20:08:24.32 ID: Be:
    値渡しと参照渡しの違いって
    値渡しは変数を渡して
    参照渡しはポインタ型の変数を渡して、関数に間接参照で値を詰めさせる
    であってますか? 

237 デフォルトの名無しさん [sage] 2012/03/16(金) 20:14:09.41 ID: Be:
    >>233
    スレ違い 

238 デフォルトの名無しさん [sage] 2012/03/16(金) 20:15:03.87 ID: Be:
    >>233
    Cには値渡ししかない。 

242 デフォルトの名無しさん [sage] 2012/03/16(金) 20:43:19.40 ID: Be:
    >>238
    実に哲学的だな 

243 デフォルトの名無しさん [sage] 2012/03/16(金) 20:47:56.09 ID: Be:
    あほ?
    C++には参照渡しが導入されたが、operatorに使うくらいにした方がいい。 

244 デフォルトの名無しさん [] 2012/03/16(金) 20:55:01.35 ID: Be:
    >>238
    あの本の信者か 

245 デフォルトの名無しさん [sage] 2012/03/16(金) 20:57:42.58 ID: Be:
    >>243
    理由は? 

246 デフォルトの名無しさん [sage] 2012/03/16(金) 21:00:40.19 ID: Be:
    シグネチャをいちいち確認しなきゃいけないからだよ。 

247 デフォルトの名無しさん [sage] 2012/03/16(金) 21:01:06.11 ID: Be:
    Googleのコーディングスタイルだと、参照使うのはconstつける時だけにしようぜってなってるね。
    ようするに入力なのか出力なのかぱっと見でわからんという事なんだろうな。
    ちなみにここってC言語のスレだよね。 

248 デフォルトの名無しさん [sage] 2012/03/16(金) 21:02:18.44 ID: Be:
    そうね、constつきならおk。 

249 デフォルトの名無しさん [sage] 2012/03/16(金) 21:02:36.61 ID: Be:
    >>243
    あれは本当にまずい機能だった 

255 ◆QZaw55cn4c [sage] 2012/03/16(金) 21:15:59.52 ID: Be:
    >>249
    pascal では参照呼出しは普通というかなくてはならないんですけれども 

258 デフォルトの名無しさん [sage] 2012/03/16(金) 21:17:35.97 ID: Be:
    >>255
    理由を言ってみろよ、クズ。 

266 はちみつ餃子 ◆8X2XSCHEME [sage] 2012/03/16(金) 21:25:54.65 ID: Be:
    >>232
    規格内では「空文字列」という言葉を使ってないみたい。
    だた、「空」で始まる言葉は全て「くう」に相当する順のところに配置されてはいるので、それに準ずるのが妥当だと思う。

    http://freedeai.180r.com/up/src/up10471.png
    「空」はキて始まる言葉の後に配置されてる。 

「空集合」は「くうしゅうごう」と読むけど 「空文字列」は「からもじれつ」と読んでたなあ。

■_

■_

それにつけても以下略

2012年03月15日

■_

最近、「品質」という言葉がゲシュタルト崩壊しそうなほどその辺の調べ物ががが。 その途中でいけがみさんの日記がひっかかったり Inemuri nezumi diary(2008-06-04)

どこでテストをやめるのかということについて、 いけがみさんが指摘しているスライドの内容は(ぴー)ですが、 確率モデルを使ったどの程度バグを見つけ出せたか(まだどのくらい潜んでいるか) というやり方を始めとしてたくさんの「モデル」があるようで。 超幾何分布とか非同次ポアソン過程モデルとか出てきました。 くわしくはこの辺 → ソフトウェア信頼性評価 における最近の話題 http://sel.ist.osaka-u.ac.jp/~kusumoto/force/slides/dohi.pdf

■_ 閏年バグ

reddit でかなりの大人気

Lazy coding practice takes down Microsoft's Azure cloud platform. Someone just incremented the year to a leap year date and didn't check if that new date was good. : programming

Lazy coding practice takes down Microsoft's Azure cloud platform. Someone just incremented the
year to a leap year date and didn't check if that new date was good. (blogs.msdn.com)


Good lord. What programmer just increments a date with an integer? We have extensively 
tested and vetted date-handling APIs for a goddamn reason.


Well, it also depends on your environment. I mean, the code I write at home is much more
solid, stable, and easier to maintain, but that's because I'm not having to meet immovable
deadlines with product management forcing feature creep on me.


I agree, but one could hope that a company like Microsoft had learned how to plan 
development of software by now.


Microsoft wrote the C# DateTime class which is arguably the best date/time management 
API anywhere.


Yes, this makes this problem all the more confusing. They're really aware of 
international/locale issues throughout .NET as well as the intricaties of time 
management, and yes, DateTime has .AddYears() exactly for this issue.

One may excuse this as a simple oversight, but you have to be really tired or caffeine 
depraved as a developer to not instantly realize the issues with "year + 1"... 
It's almost as bad as "if (i = 1)" when intending a comparison.


Honestly I'm going to go ahead and defend the guy who did this, I'm 100% sure he did 
not do this because he was incompetent or wanted to be lazy (in fact he did the 
opposite of lazyness), I'm convinced he was just tired and caffeine deprived, Apple 
probably wanted Azure delivered for the iCloud services or something the next day.

If you reckon you're someone who has never screwed up code in a stupid way like this 
then you've never really been put under the pump.

Part of our system failed on 2/29 because I did this: DateTime t = new DateTime(2099, DateTime.Today.Month, DateTime.Today.Day);

Definitely not lazy. Simply forgot. Time is a tricky thing sometimes.


I agree that having crushing requirements makes producing good code difficult, but 
taking tiny shortcuts like these mean you'll get even less done because you're 
constantly having to fix them.

Yep, and even Microsoft has a decent date and time API. Here's the code:

DateTime leapYearsDay = new DateTime(2012, 2, 29);
Console.Out.WriteLine("leap years day is: " + leapYearsDay);

DateTime oneYearLater = leapYearsDay.AddYears(1);
Console.Out.WriteLine("One year later is: " + oneYearLater);

The output is:

leap years day is: 29/02/2012 00:00:00  
One year later is: 28/02/2013 00:00:00


Yeah, it's also worth mentioning that it seems like Apple has completely bungled every single
DST switch since the release of the first iPhone. I'm sure they probably got one of them
right somewhere, but it sure seems like I read articles every single time about alarms not
going off, timezones being reset to nonsensical values, etc.

Time is hard. Though it probably should be said, this particular bug isn't one of 
trickier ones to avoid.

Microsoft's original Zune had a leapyear issue, too, that caused devices to lock up 'til the
battery drained.

If memory serves me, the peripheral library Freescale provides for their MCU's RTCC had a
bug in it that caused an infinite loop. So basically everything that used Freescale's code
had the same problem.
What is "the same date next year" for february 29 anyway?


Perhaps the real problem is trying to attempt to find a date "next year" at all,
given that there is no single value for "1 year". Perhaps all deltas should be
expressed -- as a best practice -- in terms of a more fixed time such as a second. So, if
you want to put a year expiry on a certificate you're generating, you do
"now() + 31536000 seconds".

Even expressing it as 365 days is more explicit, but there's a reason why Unix timestamps are
so popular as an unambiguous number of seconds since a fixed point in time.

According to .Net's DateTime class, "29 Feb 2012" plus 1 year is "28 Feb, 2013". The code is here


This is what Perl's DateTime does as well On the other hand, Perl's DateTime gets it correct:

perl -MDateTime -wle'my $dt = DateTime->new(year=>2012,month=>02,day=>29); $dt->add(years=>1); print $dt'
2013-03-01T00:00:00

perl -MDateTime -wle'my $dt = DateTime->new(year=>2012, month=>02, day=>29); $dt->add_duration(DateTime::Duration->new(years=>1)); print $dt'
2013-03-01T00:00:00


My question is: why the hell do we have leap years? Who cares where the moon is in 
relation to the number I give to a day?

■_

■_

Cプログラム高速化研究班~コードを高速化する20の実験と達人の技~ が見つからんのじゃよ~

2012年03月14日

■_

日本のプロ野球のデータを使ったセイバーメトリックス本てのが出てたんですね。 元巨人の桑田の著書もなんかあたらしいのが。

NaN boxing - 枕を欹てて聴く
この boxing を「ボックス化」とかしたら以下略

■_ 塹壕で

暫くスルーしてたのですが相変わらずなのでつい。

全文突っ込みどころと言えなくもないのですが、いくつか絞って。

InfoQ: Visual Studio 11:誰が開発者のために開発するのか?

Visual Studio 11:誰が開発者のために開発するのか?

Visual Studio 11のニュースには、ユーザーインターフェースやプロジェクトマネージメントフィーチャ
についての多くの情報がある。重要ではあるが、それらは開発者が毎日直面している一番重要な仕事であ
る、高品質な製品コードを書くということからは、ずれている。VS11はこれまでのコンシューマ製品では
ない。もしMicrosoftが誰をターゲットにしているのかについて、もし戸惑いがあるとすれば、最近の公
開内容を見せれば、読者に対して言い訳ができる。では、Microsoftが塹壕にいるC++開発者に、提供でき
る新しいフィーチャは何か?

(略)

MicrosoftはVS11の追加のベータ版について何もアナウンスしていない。しかし更なる改良が期
待されている。氏の非同期的なリリースに関するコメントは、開発者がMicrosoftのこれまでの
複数年かかる開発・テスト・リリースのサイクルを待たずに、将来の機能を手にできる良い方法
となるだろう。

まず、「塹壕にいるC++開発者」とはなんのこっちゃいということなんですが、 原文で対応する部分を見るに C++ developers in the trenches? というのがあります。trenches → 塹壕。ではあるのですが、 in the trenches である意味を持ったイディオムになっています。 訳してて疑問を感じなかったんでしょうか? 実のところ、わたしもこのイディオムを知らなかったのですが、 「塹壕」が出てくるのはいくらなんでも何かあるとは思いました。

「MicrosoftはVS11の追加のベータ版について何もアナウンスしていない。 しかし更なる改良が期待されている」 の原文は Microsoft has not announced whether or not additional Betas will be forthcoming for VS11, but further refinements are to be expected. で、additional Beta はあるかどうかも明らかにしていないのですから 「何もアナウンスしていない」というのはちょっと違うんでない?

「氏の非同期的なリリースに関するコメントは、開発者がMicrosoftのこれまでの 複数年かかる開発・テスト・リリースのサイクルを待たずに、将来の機能を手にできる良い方法 となるだろう。」 えーとこの文はどういう構造になってるんでしょう? 修飾部分を削りまくると「コメントは良い方法になるだろう」?

「究極的にサポートする」についてはコメント欄で指摘されてますね

InfoQ: Visual Studio 11: Who Develops for the Developers?

Visual Studio 11: Who Develops for the Developers?

Posted by Jeff Martin on Mar 09, 2012

The news on Visual Studio 11 has included a lot of information about user interface changes
and project managment features. While important, they are also off-center from the primary
tasks developers face everyday, writing production quality code. VS11 is not a traditional
consumer product but with the recent publicity the reader can be excused if confusion exists
as to who Microsoft is targetting. So what new features does Microsoft have for C++ developers
in the trenches?

(略)

Microsoft has not announced whether or not additional Betas will be forthcoming for VS11, but
further refinements are to be expected.  Sutter's comments about the out-of-band releases
could prove to be a good way for future functionality to reach developers without waiting
through Microsoft's historical multi-year develop/test/release cycle.

■_ Forth

さすがにネイティブコードを吐くコンパイラーではなさげ。

Retro Programming: Itsy-Forth: the Outer Interpreter of a 1K Tiny Compiler

Itsy-Forth: the Outer Interpreter of a 1K Tiny Compiler

Itsy Forth is a tiny indirect-threaded compiler for a subset of the Forth programming 
language. The compiler contains an interactive interpreter which allows the programmer 
to define new words (subroutines), execute them and even extend the language.

Itsy Forth は Forth というプログラミング言語のサブセットに対する indirect-threaded
コンパイラーです。このコンパイラーはプログラマーが新たにワード(サブルーチン)を
定義できたり、それを実行したり、さらには言語を拡張できたりもする
対話型インタープリターを含んでいます。

Each word has an entry in the Forth dictionary. New words are defined with : and end 
with ;. The following example defines a new word inc which calls two words, 1 and +:

それぞれのワードは Forth dictionary にエントリを持っています。
新しいワードは : を使って定義し、; で終えます。
次の例は二つのワード 1 と + を呼び出す新ワード inc を定義するものです。


: inc 1 + ;

Outer Interpreter

Itsy was developed top-down, first implementing the interpreter. interpret takes the 
next word from the input buffer and searches for it in the dictionary. If the word 
isn't found, Itsy attempts to convert it to a number. In compile mode, Itsy will add 
the word or number to the current definition. Otherwise the word will be executed.

Itsy はトップダウンで開発され、最初にインタプリターを実装しています。
このインタープリターは入力バッファーから次のワードを取り出し、そのワードを
dicttionary で検索します。ワードが見つらなかった場合、Itsy はそれを数値に変換する
ことを試みます。コンパイルモードでは Itsy はそのワードあるいは数値を current の
definition に追加します。ワードが見つかればそのワードを実行します。

: interpret
begin
    #tib @ >in @ =
    if
        tib 50 accept #tib ! 0 >in !
    then
    32 word find dup
    if
        state @ =
        if
            ,
        else
            execute
        then
    else
        dup rot count >number
        if
            state @
    if
        last @ dup @ last ! dp !
    then
    abort
        then
        drop drop state @
if
            ['] lit , ,
then
    then
again
;

The Itsy interpreter uses 23 different words, 5 variables (state, >in, #tib, dp, last)
and a constant (tib). Note the variables dp and last are non-standard. dp points to the
first free cell in the data area. last points to the last word to be compiled.

この Itsy インタープリターは 23種類のワードと5つの変数 (state, >in, #tib, dp, last)、
ひとつの定数 (tib) を使っています。
変数 dp および last は非標準 (non-standard)であることに注意してください。
dp はデータエリア中の最初の free cell を指し、
last はコンパイル済みである最後のワードを指しています。


Next we'll define the dictionary structure and implement the inner interpreter. In the 
meantime I'd love to hear any comments on the code so far :-)

■_

2012年03月13日

■_

「作り込む」
とある方面の資料をいろいろ調べていると 「作り込む」という表現が良く出てくるんですが、 「バグを作り込む」のはさすがに変な気が。 偶発的に入っちゃうようなのを「作りこむ」とは言わないと思うんだけどなあ。

しばちゅーさん
話が動いてるなあ(前回の続きだけど)

■_

■_ Why is reading lines from stdin much slower in C++ than Python?

標準入力からの読み込みで、Python よりも C++ の方が遅いんだけどというお悩み

Why is reading lines from stdin much slower in C++ than Python? - Stack Overflow

I wanted to compare reading lines of string input from stdin using Python and C++ and was
shocked to see my C++ code run an order of magnitude slower than the equivalent Python code.
Since my C++ is rusty and I'm not yet an expert Pythonista, please tell me if I'm doing
something wrong or if I'm misunderstanding something.

(tl;dr version: use cin.sync_with_stdio(false);)

C++ code:

  #include <iostream>
  #include <time.h>

  using namespace std;

  int main() {
      string input_line;
      long line_count = 0;
      time_t start = time(NULL);
      int sec;
      int lps;                                                                   

      while (cin) {
          getline(cin, input_line);
          if (!cin.eof())
            line_count++;
      };

      sec = (int) time(NULL) - start;
      cerr << "Saw " << line_count << " lines in " << sec << " seconds." ;
      if (sec > 0) {
          lps = line_count / sec;
          cerr << "  Crunch speed: " << lps << endl;
      } else
          cerr << endl;
      return 0;
  }

  //Compiled with:
  //g++ -O3 -o readline_test_cpp foo.cpp

Python Equivalent:

  #!/usr/bin/env python
  import time
  import sys

  count = 0
  start = time.time()

  for line in  sys.stdin:
      count += 1

  delta_sec = int(time.time() - start_time)
  if delta_sec >= 0:
      lines_per_sec = int(round(count/delta_sec))
      print("Read {0:n} lines in {1:n} seconds. LPS: {2:n}".format(count, delta_sec,
         lines_per_sec))

Here are my results:

$ cat test_lines | ./readline_test_cpp 
Saw 5570001 lines in 9 seconds.  Crunch speed: 618889

$cat test_lines | ./readline_test.py 
Read 5570000 lines in 1 seconds. LPS: 5570000

Thanks in advance!

Edit: I should note that I tried this both under OS-X (10.6.8) and Linux 2.6.32 (RHEL 
6.2). The former is a macbook pro, the latter is a very beefy server, not that this is 
too pertinent.

(略)


Edit 7: Tiny benchmark addendum and recap

(Hello HN readers!)

For completeness, I thought I'd update the read speed for the same file on the same 
box with the original (synced) C++ code. Again, this is for a 100M line file on a fast 
disk. Here's the complete table now:

Implementation   Lines per second cin (default)       819,672 python:           
3,571,428 cin (no sync):   12,500,000 fgets:           14,285,714 wc:              
54,644,808

Also, see my follow-up question about splitting lines in C++ vs Python... a similar speed
story, where the naive approach is slower in C++!

Edit: for clarity, removed tiny bug in original code that wasn't related to the question.

The problem is synchronization with stdio -- see my answer.

wc -l is fast because it reads the stream more than one line at a time (it might be 
fread(stdin)/memchr('\n') combination). Python results are in the same order of magnitude
e.g., wc-l.py 

By default, cin is synchronized with stdio, which causes it to avoid any input 
buffering. If you add this to the top of your main, you should see much better 
performance:

cin.sync_with_stdio(false);

Normally, when an input stream is buffered, instead of reading one character at a time, 
the stream will be read in larger chunks. This reduces the number of system calls, 
which are typically relatively expensive. However, since the FILE* based stdio and 
iostreams often have separate implementations and therefore separate buffers, this 
could lead to a problem if both were used together. For example:

  int myvalue1;
  cin >> myvalue1;
  int myvalue2;
  scanf("%d",&myvalue2);

If more input was read by cin than it actually needed, then the second integer value 
wouldn't be available for the scanf function, which has its own independent buffer. 
This would lead to unexpected results.

To avoid this, by default, streams are synchronized with stdio. One common way to 
achieve this is to have cin read each character one at a time as needed using stdio 
functions. Unfortunately, this introduces a lot of overhead. For small amounts of 
input, this isn't a big problem, but when you are reading millions of lines, the 
performance penalty is significant.

Fortunately, the library designers decided that you should also be able to disable 
this feature to get improved performance if you knew what you were doing, so they 
provided the sync_with_stdio method.

こちらでも Why is reading lines from stdin much slower in C++ than Python? - Stack Overflow : programming

■_

天才プログラマーでも Rock Star でもないあなたが オープンソースプロジェクトへの貢献する14の方法

14 Ways to Contribute to Open Source without Being a Programming Genius or a Rock Star

14 Ways to Contribute to Open Source without Being a Programming Genius or a Rock Star

Plenty of people want to get involved in open source, but don't know where to start. 
Here are several ways to help out even if you lack confidence in your technical chops.

by Andy Lester | March 11, 2012 7 Comments and 235 Reactions

Open source software has changed computing and the world, and many of you would love to
contribute. Unfortunately, many people are daunted by what they imagine is a high barrier
to entry into a project. I commonly hear people say that they'd love to contribute but
can't because of three reasons:

    “I'm not a very good programmer.”
    “I don't have much time to put into it.”
    “I don't know what project to work on.”

There are three core principles to remember as you look for opportunities to contribute:

    Projects need contributions from everyone of all skills and levels of expertise.
    The smallest of contributions is still more than none.
    The best project to start working on is one that you use already.

(略)

■_ InfoQ: Martin Odersky on Typesafe Stack and the Future of Scala

いんたびう。これも翻訳されるかな?

InfoQ: Martin Odersky on Typesafe Stack and the Future of Scala

Martin, is of course, the creator of the Scala programming language as well as the 
Chairman, co-founder and Chief Architect of Typesafe. He is also the author of 
"Programming in Scala," creator of  javac and scalac, and was a student of 
Niklaus Wirth, the creator of Pascal, at ETH Zürich where he received his doctorate.

InfoQ: Let's get the easy questions out of the way. First, can you tell us what you're 
working on right now?

    Martin: I'm putting the finishing touches on the implementation of the value class 
    proposal, Scala Improvement Proposal 15. The idea is to have extremely lightweight 
    classes that do not need object allocation for their instances. Interestingly it can 
    be done without introducing new syntax in Scala.

(略)
all content copyright © 2006-2012 C4Media Inc.

■_

2012年03月12日

■_

今回は長め The R-Podcast Episode 3: Basic Interaction with R » The R-Podcast

「ういういDays」終わりましたねえ

■_ xargs

xargs も find も最近あまり使ってない気がする

シェルスクリプト総合 その19

455 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 03:13:24.48 ID: Be:
    a=0
    for FILE in `find / \( -iname "zoo*.png" -o -iname "land*.png" -o -iname "zoo*.txt -o -iname "land*.txt" \)`; do
    rm -vf $FILE
    echo $a
    done
    初心者です、スクリプト書いてみたんですが、この$aで表示される数がおかしくてこまってます。
    なぜかrmコマンドでは1つも削除されておらずメッセージも表示されていないのに4と表示されるのです。
    やりたい事としてはこうです↓

    「zoo*.png、land*.png、zoo*.txt、land*.txtというファイル名のファイルを全て削除し、その数をカウントする」

    何がおかしいのでしょうか? 

456 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 04:32:12.07 ID: Be:
    >>455
    4が表示されるのはオカルト。君もうすぐ死ぬんじゃない?
    ファイルを削除して数をカウントしたいだけなら

    find ほにゃらら -print0 | xargs -0 rm -v | wc -l

    でよい。変数もforも必要ない。
    4が出るのは君がオリジナルのスクリプトをここにコピペするときに何か端折ったせいだろう。 

457 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 04:53:51.30 ID: Be:
    >>456
    ごめんなさい、a=$(($a + 1))が抜けてました...

    にしてもこんなにコンパクトになるもんなんですね
    ありがとうございました 

458 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 08:05:01.28 ID: Be:
    xargsは原始人の道具。
    find ほにゃらら -exec rm -v {} + | wc -l
    で良い。 

459 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 08:11:05.46 ID: Be:
    -deleteが使えるfindもある
    find ほにゃらら -delete -print | wc -l 

460 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 08:14:18.54 ID: Be:
    >>458
    -exec の方が古い感覚だけどどうなんだろ? 

461 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 08:17:25.43 ID: Be:
    >>460
    -exec ';' なら古い感覚
    -exec + は新しい感覚 

462 460 [sage] 2012/03/11(日) 08:29:08.31 ID: Be:
    >>460
    + はいま使っているマシンの中では使えない物がほとんどかも。

    -exec は元々 Unix に魅せられたポイントなので、1989 年には使ってた。
    xargs はネットで教えてもらって 1995 年頃から使い始めた。
    けど確か元からあったかも。 

463 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 08:32:05.19 ID: Be:
    >>462
    -exec + はSolarisでさえ使えるのに、どんな古いOS使ってるんだよ? 

464 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 08:54:41.56 ID: Be:
    POSIXにも入っていてSVR4由来(当然Solarisにもある)でHP-UXにもあるのに、
    使えないのを探す方が難しいよね。
    原始人と言われたからってムキになってウソを教えるのは良くないな。

    http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-210.html
    | One of these extensions, which I believe is supported at least on all
    | systems derived from SVR4 and on HP-UX (although in some cases it is an
    | undocumented feature), is a variant of the "find -exec" primary where
    | "find" does argument aggregation internally:
    |
    | find . -type f -exec some_command {} + 

465 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 09:52:56.43 ID: Be:
    ちょっと前までテンプレにfindの項があったと思うが、今は無くなってるな。
    確かテンプレではfind -print0 | xargs -0推奨で、スレ内議論では-exec +を使えと主張する人がいた。 

466 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 10:09:06.10 ID: Be:
    テンプレにあったのはfind -print | xargs という回答には必ず言いがかりが付け
    られていたから。質問者のためではなく回答者のためのテンプレ。
    -exec {} + 構文が紹介されてからはxargsを使う意味がなくなったのか削除された。

    それでもしばらくは-exec {} + を知らない原始人がいたけど、そのたびに原始人と
    呼ばれて、絶滅していった。テンプレから削除されたのはこの時点(絶滅後)かも。

    -exec {} + ですべてが置き換え可能とは言わないが、find+xargsが必要になること
    は極めてまれ。 

467 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 10:32:32.19 ID: Be:
    うーむ、結局その2つ違いって何ですか?

    あと、パイプで繋がってしまっているrmを画面にも出力する方法ってないんでしょうか? 

468 460 [sage] 2012/03/11(日) 10:44:50.32 ID: Be:
    俺が xargs 教えてもらった頃は
    -exec は fork するから良くないと言われてた。

    + は SVR4 に入っているのなら俺のもだいたい動くね。
    でも俺まだ Tower の SVR2 や SVR3 とも格闘してるから。
    ファイル名の長さが 14 文字までのやつ。 

469 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 10:44:55.57 ID: Be:
    >>467
    2つの違い
    -print0や xargs -0は使えないOSがある。

    >パイプで繋がってしまっているrmを画面にも
    tee 

470 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 10:55:09.82 ID: Be:
    >>467
    1 find -exec \; 構文ではファイル一つ毎に別プロセスが起動されるので効率が悪い。
    2 そこでまとめて処理できるようxargsが作られた。初出はPWBだからかなり古い
    find -print | xargs
    3 ファイル名に改行入れられるとヤバいので-print0, -0が設けられた
     find -print0 |xargs -0
    4 そんな面倒な事しなくて済むように-exec {} + 構文が作られた
     -exec \; 構文と違い、別プロセスは(MAX_ARGSを考慮して)まとめて実行される。

    > あと、パイプで繋がってしまっているrmを画面にも出力する方法ってないんでしょうか?
    find ほにゃらら -delete -print |tee /dev/tty| wc -l
    find ほにゃらら -exec rm -v {} + |tee /dev/tty| wc -l 

473 460 [sage] 2012/03/11(日) 11:04:39.92 ID: Be:
    >>470
    + 便利そうだな。 

474 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 11:06:35.90 ID: Be:
    -0はFreeBSD 2.1.5-RELEASEにはない。FreeBSD 2.1.6.1-RELEASEにはある。
    相当昔といえば言えなくはないが。

    http://www.freebsd.org/cgi/man.cgi?query=xargs&apropos=0&sektion=0&manpath=FreeBSD+2.1.5-RELEASE&arch=default&format=html

    http://www.freebsd.org/cgi/man.cgi?query=xargs&apropos=0&sektion=0&manpath=FreeBSD+2.1.6.1-RELEASE&arch=default&format=html 

475 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 11:22:05.20 ID: Be:
    結局、自分が使ってるOSで使える方法を使えって結論になってるよね毎回 

476 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 11:29:54.60 ID: Be:
    答える側は質問者の環境を想像すべきだな。
    SVR[23]のような骨董環境前提の回答なんか意味ない。 

477 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 11:38:38.97 ID: Be:
    それなら結局xargsでも-exec +でもどっちでも良いんじゃない?十分に新しいLinux/*BSD環境前提なら。
    自分はタイプ数の多いxargsは使わないけどね。
    無用な-exec \;と-0無しのxargsさえ避ければ良い。
    そもそも今回は-deleteが使えるならxargsも-exec +も要らないし。 

478 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 11:42:53.84 ID: Be:
    >>477
    だから、使える方法を使えばいいってことでしょ?
    結論見えてないの? 

479 名無しさん@お腹いっぱい。 [sage] 2012/03/11(日) 11:51:09.25 ID: Be:
    >>469>>470
    できました!!ありがとうございましたm(_ _)m 


■_ OCaml

金融関係でよくCamlが使われるのはなぜ?

programming languages - Why do hedge funds and financial services often use Caml? - Stack Overflow


Speaking to a number of quants / hedgies, I came to the conclusion that a large number of
them seem to be using either a homebrew language or Objective Caml for many tasks. What many
of them couldn't answer was why.

I can certainly understand why they wouldnt want to use C++ for the most part, but why is
Caml superior for these uses compared to other scripting languages, say Python, Ruby etc?


Try reading Caml trading - experiences with functional programming on Wall Street by Yaron
Minsky and Stephen Weeks. They go into great detail about what they feel are the advantages
and disadvantages of OCaml, though they for the most part take it as a given that it is
better than most other options they considered (i.e. not a lot of direct comparisons with
C++, Python, what have you).

The authors work at Jane Street Capital which has invested heavily in OCaml code.

Update: See also the thread What programming language(s) is algorithmic trading software
written in?. One of the comments mentions a presentation Yaron Minsky gave at CMU on Jane
Street Capital's use of Caml. About an hour long, and very interesting.

Being a functional language, it is mathematical in nature, which probably fits in nicely with
the kinds of problems these firms need to solve. And as others have pointed out, it has a
nice performance profile.

Maybe this is why Microsoft co-opted OCaml for F#

■_

2012年03月11日

■_

最外簡約がわからなくなった…

■_ hjkl

vi のカーソル移動のキーが H J K L になっているのは何でという話で Here is why vim uses the hjkl keys as arrow keys - good coders code, great reuse

Here is why vim uses the hjkl keys as arrow keys - good coders code, great reuse

Here is why vim uses the hjkl keys as arrow keys

I was reading about vim the other day and found out why it used hjkl keys as arrow keys.
When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows
on hjkl keys. Naturally he reused the same keys and the rest is history!

Here is how the hjkl keys looked:

ADM-3A keyboard's hjkl keys with arrows.

And here is the whole terminal that vi was created on:

vi 開発時にBill Joy が使ってた端末の配列からというのがあって、

■_ hjkl その2

こう反応が

Here is why vim uses the hjkl keys as arrow keys : programming

So, this is a fraction of the information you'd find if you just looked up Vi on Wikipedia,
which has lots on vi's history, including this great quote from Bill Joy, creator of vi

    I wish we hadn't used all the keys on the keyboard. I think one of the interesting things
    is that vi is really a mode-based editor. I think as mode-based editors go, it's pretty
    good. One of the good things about EMACS, though, is its programmability and the
    modelessness. Those are two ideas which never occurred to me. I also wasn't very good at
    optimizing code when I wrote vi. I think the redisplay module of the editor is almost
    intractable. It does a really good job for what it does, but when you're writing
    programs as you're learning... That's why I stopped working on it. What actually
    happened was that I was in the process of adding multiwindows to vi when we installed
    our VAX, which would have been in December of '78. We didn't have any backups and the
    tape drive broke. I continued to work even without being able to do backups. And then
    the source code got scrunched and I didn't have a complete listing. I had almost
    rewritten all of the display code for windows, and that was when I gave up. After that,
    I went back to the previous version and just documented the code, finished the manual
    and closed it off. If that scrunch had not happened, vi would have multiple windows,
    and I might have put in some programmability—but I don't know. The fundamental problem
    with vi is that it doesn't have a mouse and therefore you've got all these commands. In
    some sense, its backwards from the kind of thing you'd get from a mouse-oriented thing.
    I think multiple levels of undo would be wonderful, too. But fundamentally, vi is still
    ed inside. You can't really fool it. Its like one of those pinatas—things that have candy
    inside but has layer after layer of paper mache on top. It doesn't really have a unified
    concept. I think if I were going to go back—I wouldn't go back, but start over again.


A very interesting quote that is pretty much directly opposite to what many vi and vim 
fanboys say, since they of course insist that they defining features of vi and vim are 
hugely advantageous and proof of careful design.

The original designer of vi actually thinks a mouse would be a good idea? The modal 
editing and all those commands is, to the original designer, "the fundamental 
problem with vi"? There are plenty of vi fanboys who'd lynch you for saying that.

あとで訳す。…余裕があったら

■_

B O T S U

■_ rakudo

そろそろ新しくするかなあ

Macros progress report: D1 merged :: Strangely Consistent

Macros progress report: D1 merged

I've merged my first chunk of work, known to the grant application as "D1", 
into the nom branch of Rakudo. Concretely, this means three things:

    The next release of Rakudo (release #50, due 2012-03-22) will be the first release 
    of any Perl 6 implementation to feature AST macros.

    People who have a new-enough revision of the nom branch checked out can play around
    with basic macros already.

    There's just three chunks of work left to do. :-)

(以下略)

■_ foldr

この辺も今ひとつ腑に落ちてない

Why does foldr work on infinite lists but not foldl? : haskell

Why does foldr work on infinite lists but not foldl? (self.haskell)


Shouldn't it be the other way around or am I missing something? If you start at the right
side of a list that is infinite you can never start, because you never get to that element.
What am I missing?


Because with foldr the result has the form "f(x1, ...)", and x1 is 
immediately available.

With foldl the result has the form "f(..., xLast)", and xLast is not 
immediately available.

If lists were stored not as (first,rest) but as (rest,last), then foldl would be lazy 
and foldr would be not.

Just to clear things up a bit. This is foldr:

  f(x1, f(x2, f(x3, f( ... ))))

And this is foldl:

  f(f(f(f( ... ) xn-3) xn-2) xn-1)


And I'd add that evaluation is outermost first.


nope. I still don't see the difference.


Excellent question! Stack Overflow has the answer:

Foldr vs Foldl


Try folding const on an infinite list by hand and see what happens. Remember lazy evaluation.


I think "foldr" should be read as fold-right-associatively, and not 
"fold-from-the-right". It's a question of how the parenthesis are arranged 
and not a question of where you "start" from, because "start" is 
not really meaningful when you have lazy evaluation and the order depends on the given 
functions.


Note that foldr "works" on an infinite list only if the folding fuction is 
lazy enough in its tail-result argument. If you implement (length :: [a] -> Integer) 
as a fold, no matter which one you choose you'll loop. On the contrary, you can 
implement (length :: [a] -> Nat) with (data Nat = Z | S of Nat) and use it in 
reasonable ways -- eg. to ask "is my list at least 3 elements long?".

(We say that infinite lists are "coinductive" data structures, and that 
folding them must be "productive", meaning that the result becomes at least 
partially defined after a finite number of evaluation steps.)
Thanks, your responses and that stack overflow question cleared it up.

■_

■_

数学セミナー、今日は買いにいけないなあ (行ける範囲にある本屋で扱ってない)。


一つ前へ 2012年3月(上旬)
一つ後へ 2012年3月(下旬)

ホームへ


リンクはご自由にどうぞ

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