ときどきの雑記帖 i戦士篇

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

一つ前へ 2009年9月(下旬)
一つ後へ 2009年10月(中旬)

ホームへ

2009年10月10日

■_

・圏論デスレース
参加された方々、特に遠方から泊りがけでいらした方お疲れ様でした。 もうちょっと「薄味」だと参加できるんですが、とか書くと 自分で主催しろという流れだなw

・第二弾
ちょっと前に一部で話題になった(のか?) 数学は言葉―math stories という本がありましたが、シリーズ第二弾が出たようです(筆者が違いますが第三弾も予定されているようです)。 計算とは何か (math stories)
結構面白いので一読をオススメ。って目次くらい写したほうがいいのかしらん。

・東スポ
いくら東スポでもこれはないんじゃないかなあw(10月10日発売のもの)

芸能人同士の交通事故は本当に珍しい。 そこで経済アナリストの門倉貴史氏に2人が事故を起こした確率について試算してもらった。 「芸能人同士で交通事故が発生する確率ですが、約4708億分の1となります。 最低限の要素で計算した確率ですので、実際にはさらに低い確率になると思います」 門倉氏は計算式をこう解説した。 「ある損害保険会社の調査によると、1年間に交通事故が発生する確率が約100分の1。 1年間のある特定の日に交通事故が起きる確率が365分の1。 特定の東京都民が偶然出会う確率が約1290万分の1(東京都民の人口は約1290万人)。 これらをすべて掛け合わせると約4708億分の1という結果になります。 計算では東京都民が芸能人である確率は加味していません」

・ぽて
新刊(4巻)が出てたので買った。ひょっとしてこれで終わりなの?
ぽてまよ 4 (アクションコミックス アクションコミックスもえよん)
ドラマのよお~に~♪

・ライオリ
中央モノローグ線、そういう展開かっ(笑)

■_ ばぐれぽ

まあPHPの件は特に意見もないんですが(ついったではちょっとつぶやいたけど)。


はじめてのにき(2009-10-10)
バグ報告とか

なにやら大変面白い話が。

http://d.hatena.ne.jp/IwamotoTakashi/20091006/p1

http://d.hatena.ne.jp/ku-ma-me/20091010/p1

http://akimoto.jp/blog/2009/10/08/bug-report-in-foreign-language/

個人的な感覚では、オリジナルの報告者の方も 最初に close した PHP の人も、 その後のいや
これは dup じゃないんだという主張も、 その後の直してくれるまでのやりとりもごく問題ない
ように見えるかなぁ。

(略)

そんなこんなで僕的にはごく普通の bug repot → fix の流れのひとつに見えたようにおもう。

(略)

例えば英語とか書きたくなければ、 there is a bug: <再現するコード>, expected: 
<hoge>, actual: <bug!>、 とかだけでもたぶん良いわけで。 実際 WebKit のバグとか見
てる感じでは、 最悪再現する URL だけでも良くて、 できれば再現する最小の html なりなん
なりにしてくれると良くて、 さらにそのまま test として使える程度にわかりやすい html だ
と (緑になるべきだけど赤くなるとかそういうやつ) なおよい感じかな。

以下略

自分のことで申し訳ないんですが、gawk とそれ経由で glibc (のregex)にバグを見つけたときに とっても苦労しました(この日記でもぽつぽつ書いてますが)。 というのも、「locale が ShiftJIS」 で「半角カナ(って何ですかというツッコミはなしの方向で)を 特定の場面で使ったときに」起きるバグ。だったりしたからなのですね。 何が困ったかというと、開発者の手元で同じ環境が作れなかった(作るのに苦労した)のがまず一つ。 今もそうかはわかりませんが、開発者が使っていた Fedora Core (当時は4か5だったかな) の locale に ShiftJIS がなかった!

でまあ locale のデータベース自体は作成することができるので作ってもらったんですが、 いざバグが再現しても、開発者(メンテナー)は日本語がわからないのでカタカナがちゃんと出ようが 文字化けしようがわけのわからん文字が並んでいるとしか見えなかったという(苦笑)

それまでも何度かバグ報告をしていたし、参考パッチをつけたりしたので少なくともそれを 問題だと感じる人がいるのだということは納得してもらえて修正をしてもらえました。 このときパッチには、これこれこういう問題があって、このパッチはそれをこのように修正するものだ という説明を一生懸命書きました。

ただ親玉 (glibcのメンテナー)が手ごわい人で、glibc の修正はしてもらえませんでした。 まあ、パッチを適用すると、ShiftJIS 以外も巻き込んで速度を低下させるとか、 バグの発動条件がかなり限定されるということもあったのでしょう。 それに自分も全体を巻き込んでまでするような修正ではないと思ってましたし (ではなぜ gawkのほうではという指摘は、まあいろいろあるということでひとつ)。

■_

オープンソース十周年に寄せて書かれた記事。 全七章の最初と最後。間の五つの章ではオープンソース関係者によるものが入ります。 第6章だけは以前訳を載せてます(Tclの作者のぶん)。

Open Source Decade: 10 years after the Free Software Summit: Page 1
In the beginning...

One of the most significant moments in the history of the modern software industry 
took place in 1998 when Netscape announced plans to release the source code of its 
browser under a license that would freely permit modification and redistribution. That 
pivotal event represents the point at which software freedom extended its reach beyond 
the enthusiast community and began its ascent into the mainstream.

近代のソフトウェア産業の歴史における最も重要な運動は1998 年にNetscape が自身のブラウザ
ーのソースコードを自由に修正や再配布が許されるライセンスの下で公開するプランをアナウン
スしたときに始まりました。その pivotal event はソフトウェアの自由をその熱狂的なコミュ
ニティの枠を越えて広げ、メインストリームへと押し出すことを意味していました。
#自信ねー

After the announcement, Netscape assembled a group experts to participate in a 
strategy session at which the term "open source" was first conceived. The 
participants also assembled a new philosophy that reconciled the ideological 
principles of software freedom with the pragmatism of commercial software development. 
The Open Source Initiative (OSI) was then founded to supply and maintain an official 
definition for the open source philosophy.

このアナウンスのあと、Netscape は"open source" という言葉が最初に考案された
strategy session に参加するエキスパートを集めたグループを作りました。The participants 
also assembled a new philosophy thatそしてその参加者たちはイデオロギー的なソフトウェア
の自由の原則 ( principles of software freedom)と少々ソフトウェア開発のパラダイムとをす
りあわせる新しい哲学  (philosophy) も組み立てました。Open Source Initiative (OSI) はオ
ープンソースの哲学の公式な定義を提供するためとそれを保つことを目的として設立されました。

The open-source philosophy was presented to the public at the Free Software Summit on 
April 8, 1998. The event, which was organized by Tim O'Reilly in response to growing 
interest in Netscape's new strategy, brought together the founders of the most 
prominent open-source software projects and many other industry insiders, including 
Linus Torvalds, Eric Allman, Kirk McKusick, Michael Tiemann, Eric Raymond, John 
Gilmore, Paul Vixie, Brian Behlendorf, Jamie Zawinsky, Tom Paquin, John Ousterhout, 
Phil Zimmermann, Rich Morin, Mark Stone, Greg Olson, Fred Baker, Larry Wall, and Guido 
van Rossum.

オープンソースの哲学 (open-source philosophy) は 1998年4月8日のFree Software Summit で
公にされました。Netscape の新しい戦略における growing interest に呼応するものとしてTim 
O'Reilly によって orgnaized されたこのイベントは most prominent なオープンソースプロジ
ェクトの founders とmany other industry insiders を一堂に集めました。その中には、Linus 
Torvalds, Eric Allman, Kirk McKusick, Michael Tiemann, Eric Raymond, John Gilmore, 
Paul Vixie, Brian Behlendorf, Jamie Zawinsky, Tom Paquin, John Ousterhout, Phil 
Zimmermann, Rich Morin, Mark Stone, Greg Olson, Fred Baker, Larry Wall, Guido van 
Rossum といった人たちの名前もありました。

Ten years after the vision of software freedom gave birth to the broader open-source 
software movement, the software industry is a radically different place. Today, 
open-source software can be found everywhere from cell phones to server rooms. Surveys 
show that the vast majority of software companies use open-source software in their 
development stack. The open-source Linux operating system is even used in a number of 
popular products like the TiVo and Amazon Kindle.

ソフトウェアの自由のビジョンがオープンソースソフトウェア運動を産み落としてから十年のの
ち、ソフトウェア産業は劇的にその様相を異なるものとしました。今日、オープンソースソフト
ウェアは携帯電話からサーバールームまでいたるところで見つけることができます。ソフトウェ
ア企業が彼らの開発スタックでオープンソースソフトウェアを使っているのが広く確認できます。
オープンソースのLinxu オペレーティングシステムはTiVo や Amazon Kindle のようなたくさん
の popular products にも使われています。

To celebrate the success of the past ten years and reflect on some of the challenges 
that the open-source software community will face in the future, we spoke to some of 
the pioneers who were there on day zero when revolution started. We want to share 
their perspectives on a wide range of issues, including software patents, the emerging 
challenges and opportunities created by cloud computing, open-source software on the 
desktop, the importance of interoperability, and the ongoing fight to bring software 
freedom to the masses.

過去十年の成功を selebrate するために、また、オープンソースソフトウェアコミュニティが
将来直面するであろう some of the challenges を反映させるにわたしたちは革命が始まったそ
のときにいたパイオニアたちの幾人かと話をしました。わたしたちはソフトウェア特許や、クラ
ウドコンピューティングによって emerging される挑戦や創出される機会、デスクトップ上のオ
ープンソースソフトウェアinteroperablity の重要性、ソフトウェアの自由を masses に 
brings するために今も行われている戦い。といった広い範囲に渡ることがらを含んだ彼らの 
perspectives を皆と共有したいと願っています。

Open Source Decade: 10 years after the Free Software Summit: Page 7

Conclusions (結論)

The open-source software movement has a rich history and promising future. The legacy 
of Netscape's early vision lives on today in Mozilla Firefox, which is one of the most 
highly visible and widely used open-source software applications in existence. The 
rapidly climbing market share of the Firefox browser is a reflection of the growing 
viability of open-source software on the desktop.

オープンソースソフトウェアムーブメントは豊かな歴史と約束された未来とを持っています。
Netscape の early vision における legacy は今日も最も目につくものであり広く使われてい
るオープンソースソフトウェアアプリケーションである Mozilla Firefox の中に生きています。
Firefox ブラウザーが占める市場シェアの急速な増加はデスクトップにおけるオープンソースソ
フトウェアの growing viability を反映したものです。

The open-source pioneers who shared with us their perspectives on software freedom 
predict many things for the future. Some see the limitations of the model as an 
intractable impediment to broader adoption, and others see those same limitations as 
problems that can be solved. Many of them express concerns about software patents, an 
issue that the open-source community has mobilized to address.

ソフトウェアの自由についての perspectives をわたしたちと共有したオープンソースのパイオ
ニアたちは、未来に起きる多くのことを予見 (predict) しました。intractable impediment を 
広く適用することのように、このモデルに限界を見た人たちもいました。その一方で別の人たち
は同じ限界を解決可能な問題であると判断しました。彼らの多くはソフトウェア特許に関する 
concerns を express し、オープンソースコミュニティについての issue はmobilized to 
address されました。

In keeping with the spirit of open source, we want to expand the questions asked and 
answered in this article into an open dialog. Now that we have heard from some of the 
founding voices of the open-source movement, we pose the same questions to you. Let us 
know what you think, and share your thoughts about the past and future of open-source 
software in the discussion thread.

オープンソースの精神を保ちつづける中でわたしたちはこの article にある質問と回答を open 
dialog へと展開 (expand) することを望んでいます。オープンソースムーブメントの founding 
voices の幾つかを聴いた今、わたしたちは同じ質問をあなたに pose します。あなたの考えて
いることをわたしたちに知らせて欲しいのです。そしてディスカッションされたオープンソース
ソフトウェアの過去と未来についてのあなたの考えを共有しましょう。

■_ 本日の巡回から

■_ あとで(ry

MiniPerl6 2.0 "Perlito" bootstrapped in Javascript - nntp.perl.org

MiniPerl6 2.0 "Perlito" bootstrapped in Javascript

Subject:
MiniPerl6 2.0 "Perlito" bootstrapped in Javascript

MiniPerl6 (mp6) is a subset of Perl 6, which was designed as a light
bootstrapping language. MiniPerl6 is now self-hosted in Javascript,
Lisp and in Perl 5.

This page runs the compiler in the browser (tested in Firefox and Safari):

  http://perlcabal.org/~fglock/perlito.html

MiniPerl6 source code and images can be downloaded from the Pugs repository:

  svn checkout http://svn.pugscode.org/pugs pugs
  cd pugs/v6/v6-MiniPerl6

- Flávio S. Glock

    * MiniPerl6 2.0 "Perlito" bootstrapped in Javascript by Flavio S. Glock

ん、pugs?

2009年10月09日

■_

三連休はいろんなところでいろんなことがあるようですね。 圏論デスレースに参加される人はがんばってねー♪

■_

初めて覚えた言語によって身についてしまった悪習。

What bad habits did you learn from your first language? - Stack Overflow

I suspect that many of us didn't initially learn programming from a class, but picked 
it up on our own. What are some bad habits you picked up from your first language?


goto statements


It took me a while to stop using strcpy and char myString[256] in C++ instead of the std::string class.

On the goto riff, I'd have to say my first language (Visual Basic) error handling gave me a

On Error Goto LineLabel

view that gives me bad habits when I do exception handling.
Many things:

    * Soda addiction
    * Bad vision
    * Insomnia
    * Wrist pain
    * Difficulty converting to OOP
    * Difficulty thinking in OOP
    * Writing good and efficient algorithms that people in OOP dislike
    * Thinking in procedural programming
    * Listening to heavy metal while coding
    * Arguing with myself
    * Talking to myself in code
    * Thinking that everything in nature can be proven by code

...(the list goes on)

I learned Hungarian Notation from VB3. It stuck with me for years, and finally about 
four years ago I kicked the habit.

Hungarian-esque notation from Javascript.

Because it's all duck-typing in JS and there isn't anything like a Visual Studio to 
help you inspect and refactor, it encourages you to name your variables according to 
their intended use - I still think this is one of the few valid use-cases for 
sys-Hungarian.

Prefixing objects instances with "o" is still a curse I slip into with C# 
(and hastily correct) from time to time.
My first language was C, was obsessed with pointers. Used it for everything.
Moving to C++, pointers produced some pretty weird results in objects.
In C# I miss them.

    * bad indentation
    * non consistent function, class, and variable names
    * debatable: not declaring types


For a long time I named all my interfaces IFoo and IBlah, thanks to a long time spent with COM.

嫌われてるなあ、ハンガリアンw

■_ 人を“ベスト"プログラマーにするもの

もういっちょ Stack overflow から。

What makes a person "the best" programmer? - Stack Overflow

What makes a person “the best” programmer? [closed]

Peicture this scenario:

Your first day on the job. You're talking to one of your co-workers and he points at 
someone and says "see him? he's our best programmer".

出社初日のあなた。あなたは同僚と話をしています。彼はある人物を指差していいました
 "see him? he's our best programmer"

Then you can't help but wonder. "What makes him the best programmer?".

あなたは疑問に感じずにはいられませんでした。
“彼をベストプログラマーにしているものはなんなのだろうか”
と。

What makes a person the best programmer?
ある人物をベストプログラマーにするものは何か?

writes the most secure code? knows more languages than anyone else? applies best 
practices? uses modern code practices? gets the job done faster? ...all of the above?

ほとんどセキュアなコードを書くことでしょうか?他の誰よりも多くのプログラミング言語を知
っていることでしょうか?ベストプラクティスを実践していることでしょうか?最新のコードプラ
クティスを使ってることでしょうか?仕事を仕上げるのが早いことでしょうか? …こういった
ことすべてでしょうか?


common-sense self-analysis

常識的な自己分析


The Tao of Programming (found here) has a great answer:

    A novice asked the Master: ``Here is a programmer that never designs, documents or 
    tests his programs. Yet all who know him consider him one of the best programmers in 
    the world. Why is this?''

    ある初心者が師匠に尋ねた:「ここに自分のプログラムの設計もしないしドキュメントも書かず
    テストもしないプログラマーがおります。しかし皆が、彼が全世界における best programmers
    の一人であるということを知っております。なぜでしょうか?」

    The Master replies: ``That programmer has mastered the Tao. He has gone beyond the 
    need for design; he does not become angry when the system crashes, but accepts the 
    universe without concern. He has gone beyond the need for documentation; he no longer 
    cares if anyone else sees his code. He has gone beyond the need for testing; each of 
    his programs are perfect within themselves, serene and elegant, their purpose
    self-evident. Truly, he has entered the mystery of Tao.''

    師匠はこう答えた: そのプログラマーはタオ (道)をマスターしておる。彼はすでに設計が必要
    とする段階を超越しておる。システムがクラッシュしても怒ることはないが、universe without
    concern を受け入れる。彼はドキュメントの必要性を超越していて、自分以外の誰かが自分のコ
    ードを見るのかということなどは気にも止めていない。彼はテストの必要性も超越している。
    彼のプログラムのそれぞれは、個々のものそれ自体が完全で serene かつエレガントなものであ
    り、その目的は self-evident である。正に彼は Tao の mystery に入っておるな''

In my opinion, the best programmer is someone who can do all of the following:
私見ですが、best programmer は次のような要件すべてを満たす人物です:

    * Admit they they are wrong, and have made a mistake
      自分が間違っていることやミスをしたことを認める

    * Learn new technologies out of interest, not requirement
      新しい技術を requirement でなく intereset で学ぶ。

    * Help others learn what they already know
      自分がすでに知っていることを学んでいる誰かを手助けする


Of course, there is no "best programmer" in the same sense that there is no 
"best programming language". Different styles of programming go with 
different personalities, and different personalities are better suited to different 
jobs.

“best programming language”は存在しないとのと同じ意味においては、
当然“best programmer” はいない。
異なるプログラミングスタイルは異なる個性 (personalities) と共にあり、
異なる個性は better suited to different jobs である。


Beyond problem solving skills and coding ability/experience the best people at the 
places I've worked shared 2 characteristics:

私が一緒に働いたことのある best people は
問題解決能力やコーディングの能力だとか経験以外に、
二つの charactaristics を共有していました:


1 - They're willing and able to gain fluency in new technologies on the fly. They 
don't bother others with every minor question, they read the documentation, and try 
things for themselves (and can usually figure them out without assistance). This is an 
important trait because they're often the first people to adopt a new technology, so 
there may not be anyone around to help them out.

1 -
They're willing and able to gain fluency in new technologies on the fly.
彼らは他の人のどんな些細な質問にも飽きることがなく、ドキュメントを読んで、自分自身で試
そうとしていました (大抵は手助けなしに自分たちで理解できました)これはとても大切な 
trait (性質)です。なぜならば、彼らはしばしば新技術を最初に adopt する人間になるので彼
らを助ける人は周りに一人もいないかもしれないのです。

2 - They think before talking. They don't instantly become defensive in the face of a 
potential bug, or suggestions of change. If they rip your ideas to shreds it will be 
on a basis of solid analysis, not out of fear or pettiness. If they say a bug is not 
in their code, it is because they have investigated it and can back it up.

2 - 彼らは話す前に考えます。彼らは潜在バグ (potential bug) に直面したときもすぐに防衛
的になることもないし、変更を提案したりもしません。彼らがあなたのアイデアを細かく引き裂
いたのならそれはsolid analysis に基づいてのものでfear や pettiness からきたものではあ
りません。もし彼らが自分たちのコードの中にはバグがないと主張したのであれば、それは彼ら
がコードを検査していて、back it up できるからなのです。

These are most important, and importantly things I find I can actively work on and 
improve. They're the things I focus on most as I try to become a better developer. 
Skill with a particular technology is secondary, and experience with a code base 
cannot be rushed.

これらは最も大切なことであり
and importantly things I find I can actively work on and improve.
They're the things I focus on most as I try to become a better developer. 
特定のテクノロジーを伴った技術というのは secondary で、
code base に基づく経験は rush することができない。


The best programmer in a company = gets the job done with minimal reward (or even 
people shouting when it is done!)

企業におけるベストプログラマーとは最小限の報酬
(or even people shouting when it is done!) で仕事を行う人物のこと。

Doesn't matter what you have to do, or what tools you use, the boss doesn't want to 
hear complaints or reasons why it will not happen.

あなたが行わなければならないこと、あなたが使っているツール、
上司が不満やそれが起こらない理由を聞こうとしないことは重要ではない。

If you are set a task, give a firm ETA and stick to it.

タスクを設定したら、give a firm ETA and stick to it.


A truly great programmer can work with a non-programmer to understand and build 
software which allows people to achieve their goals.

真に偉大なプログラマーは、ソフトウェアを理解し構築させるために
プログラマーでない人と一緒に作業することができる。

In addition to the "Smart and Gets Things Done" required for this, good 
communication skills, patience and empathy are vital. While "Smart" is 
pretty self-explanatory, I think the components required to "Gets Things 
Done" are more elusive.

"Smart and Gets Things Done" で要求されていることに加えて、
優れたコミュニケーションスキル、我慢強さ、empathy (感情移入、共感) が重要。
「賢さ」 ("Smart") がpretty self-explanatory なのに対して、
"Gets Things Done" に要求される components はもっと elusive だと
わたしは考えている。

elusvie 説明しにくい

The one who consistently delivers code which needs the least fixing and maintenance, 
and if it does, is easy to maintain. Who gets tasks done on time and on spec, 
sometimes above spec. Who improves the workflow for everybody by setting up 
tools/rules/guides. Who's the go-to-guy that can answer every question.

The one who consistently delivers code which needs the least fixing and maintenance, 
and if it does, is easy to maintain.
Who gets tasks done on time and on spec, sometimes above spec.
ツールやルール、ガイドラインを設定することにより全員のワークフローを改善できる人。
すべての質問に回答できる go-to-guy。

I guess it highly depends on the other team members who is the "best" though. ;)


Debugging skills (thus solving the messes everyone else creates), can give people the 
impression that you're pretty good.

デバッグのための技術 (したがって自分以外の誰がやってしまった失敗を解決する) で、
他の人にあなたが pretty good だという印象を与えられるもの。


The best programmer is the person at the company with highest SO score of course, duh

I kid, I kid :-p I think I would put these three characteristics pretty high

    * Eager to get things done in a good and clean way
      きちんとしてきれいなやり方で物事を行うことに熱意を傾ける
    * Eager to learn
      学ぶことに貪欲
    * Eager to help others and to share what he has learned
      他の人を助けることに熱心で、自分が学んだことを積極的に共有する


The best programmer on the team is the one that writes code that everyone else on the 
team can read.

チームの中のベストプログラマーとはチームの他の誰もが読めるコードを書くプログラマーである。

■_

最も美しいプログラミング言語は? Part3 
36 デフォルトの名無しさん [sage] 2009/10/09(金) 04:59:30 ID: Be:
    ちょっと前はこういうスレってHaskellって言う人であふれかえってたよね。
    彼らはどうしたんだろう。
    Haskellでアプリケーション作るのに飽きちゃったのかな? 

37 デフォルトの名無しさん [sage] 2009/10/09(金) 08:13:35 ID: Be:
    習得しやすくて早いOcamlやLisp系に鞍替えしたとか 

38 デフォルトの名無しさん [sage] 2009/10/09(金) 08:36:48 ID: Be:
    Haskellで何か作ってるのをほとんど見たことがない 

39 デフォルトの名無しさん [sage] 2009/10/09(金) 10:12:17 ID: Be:
    今月中にReal World HaskellとProgramming in Haskellの翻訳が
    出版されるから、また増えてくると予想。

    Haskell関連株ってなんかないかねぇ 

40 デフォルトの名無しさん [sage] 2009/10/09(金) 10:20:57 ID: Be:
    Haskellはアクション、モナドが面倒くさそうだからなぁ
    ちょっとした使い捨てコードなんかも気軽に作れないし
    ここらへん不純なLisp系やOcamlなんかは楽でいいな 

41 デフォルトの名無しさん [] 2009/10/09(金) 10:27:24 ID: Be:
    不純は美しくないだろ?
    美しいって言葉はschemeだけが受けることが出来る。 

42 デフォルトの名無しさん [sage] 2009/10/09(金) 10:30:13 ID: Be:
    pureとかconsistentとか、それだけじゃダメなんだ
    Remember Smalltalk! 

43 デフォルトの名無しさん [sage] 2009/10/09(金) 10:47:46 ID: Be:
    Smalltalkの何を忘れてはいけないのかな。 

Lisp Scheme Part28
259 デフォルトの名無しさん [] 2009/10/08(木) 00:34:27 ID: Be:
    lispは宇宙だ。lispは仏教だ。全ての道はlispに通ず。
    lispは心だ。lispは生き物だ。lispはすべての親玉だ。 

260 デフォルトの名無しさん [sage] 2009/10/08(木) 01:08:11 ID: Be:
    でも神託はくれない 

261 デフォルトの名無しさん [sage] 2009/10/08(木) 01:18:32 ID: Be:
    ある場所にLispよりもずっと古い神がいてな、そこには太古の言葉が
    沢山保存されているそうな。尤も誰もその意味なんて分かっちゃいない。
    ただその言葉を唱えると単位とか言う物が取り易くなるんだとか聞いたわ。 

262 デフォルトの名無しさん [sage] 2009/10/08(木) 01:21:41 ID: Be:
    Lisp神様も元はと言えばその古い神様の一部だったんだと 

263 デフォルトの名無しさん [sage] 2009/10/08(木) 11:57:44 ID: Be:
    ナイアルラトホテップの予感 

267 デフォルトの名無しさん [sage] 2009/10/09(金) 12:37:58 ID: Be:
    おーい、磯野、Lispしようぜ! 

268 デフォルトの名無しさん [sage] 2009/10/09(金) 16:23:49 ID: Be:
    磯野「うるせぇ。いまRuby書いてんだ。」 

269 デフォルトの名無しさん [sage] 2009/10/09(金) 17:38:18 ID: Be:
    マスオ「えぇ!??それがacceptable LISPなのかいぃ!!??」 

270 デフォルトの名無しさん [sage] 2009/10/09(金) 19:28:24 ID: Be:
    波平「カーさん!」 

271 デフォルトの名無しさん [sage] 2009/10/09(金) 19:29:07 ID: Be:
    ドラえもん(四次元ポケットから)「lisp マシーン!」 

272 デフォルトの名無しさん [sage] 2009/10/09(金) 19:41:21 ID: Be:
    ふね「cdrん」 

273 デフォルトの名無しさん [sage] 2009/10/09(金) 20:52:58 ID: Be:
    Lisp Lisp Lisp マシーン (Wow Wow Wow Wow)
    Lisp Lisp Lisp ステーション (Yeah Yeah Yeah Yeah)
    Lisp Lisp Lisp ファクトリー (Wow Wow Wow Wow)
    Lisp! Lisp is so wonderful 

274 デフォルトの名無しさん [sage] 2009/10/09(金) 21:47:05 ID: Be:
    >>271
    ひみつ道具は大抵Lisp制御説 

275 デフォルトの名無しさん [sage] 2009/10/09(金) 22:02:22 ID: Be:
    >>274
    それでこわれやすい道具が多いのか 

276 デフォルトの名無しさん [sage] 2009/10/09(金) 22:10:24 ID: Be:
    >>275
    こわれやすいんじゃない。使いにくいだけだ!

    タイムマシンは継続で実装説 

277 デフォルトの名無しさん [sage] 2009/10/09(金) 22:16:03 ID: Be:
    誰が過去の時代にcall/ccしたんだよ 

278 デフォルトの名無しさん [sage] 2009/10/09(金) 22:21:02 ID: Be:
    元々世界のシステムにあるのを利用しただけさ 

279 デフォルトの名無しさん [sage] 2009/10/09(金) 22:33:42 ID: Be:
    おにいちゃんをガーベージ・コレクションしに来ました

                                   by ドラミ 

280 デフォルトの名無しさん [sage] 2009/10/09(金) 22:35:29 ID: Be:
    継続内で環境を書き換えるとタイムパトロールにつかまるぞ 


Pythonのお勉強 Part35 
93 デフォルトの名無しさん [sage] 2009/10/08(木) 22:57:54 ID: Be:
    Dive into Python 3 だれか翻訳しろ 

94 デフォルトの名無しさん [sage] 2009/10/08(木) 23:00:36 ID: Be:
    じゃあ輪読しようぜ 

95 デフォルトの名無しさん [sage] 2009/10/08(木) 23:14:19 ID: Be:
    >>75が意味分からん
    何をいわんとしているのか 

96 デフォルトの名無しさん [sage] 2009/10/08(木) 23:23:14 ID: Be:
    Dive into Python 3 の翻訳は
    この前どこかで見たぜ 

97 デフォルトの名無しさん [sage] 2009/10/08(木) 23:32:57 ID: Be:
    >>93
    直訳で
    だいぶいると Python3

    翻訳すると
    Python3人口は多いです。 

98 デフォルトの名無しさん [sage] 2009/10/08(木) 23:35:27 ID: Be:
    (´・∀・`) 

99 デフォルトの名無しさん [sage] 2009/10/09(金) 02:19:29 ID: Be:
    >>93
    翻訳用のファイルを作ってコミットしておいた。
    http://code.google.com/p/diveintopython3-ja/

    暇人の方は↓のグループに参加申請してくれれば、↑のメンバーに追加します。
    http://groups.google.co.jp/group/diveintopython3-trans-ja 

100 デフォルトの名無しさん [] 2009/10/09(金) 12:11:29 ID: Be:
    思ったほど大した量じゃないね
    これはいけるかも 

101 デフォルトの名無しさん [sage] 2009/10/09(金) 12:24:03 ID: Be:
    >>99-100
    ここに移動した方がいい

    【実験台】 Python 3.0 のお勉強 Part 1 【非互換】
    http://pc12.2ch.net/test/read.cgi/tech/1235050215/ 

102 デフォルトの名無しさん [sage] 2009/10/09(金) 18:47:43 ID: Be:
    >>97
    直訳は

    大仏Python

    じゃないか? 

103 デフォルトの名無しさん [sage] 2009/10/09(金) 18:55:36 ID: Be:
      _, ._
    ( ゚ Д゚) 

105 デフォルトの名無しさん [sage] 2009/10/09(金) 19:41:37 ID: Be:
    dive into pythonもいいけど、
    ディスクリプタみたいな少しつっこんだ仕組みを解説してる文章が日本語であんまりないのも困った。 

106 デフォルトの名無しさん [sage] 2009/10/09(金) 19:44:18 ID: Be:
    ディスクリプタってopenの返り値の? 

107 デフォルトの名無しさん [sage] 2009/10/09(金) 19:50:10 ID: Be:
    property 

108 デフォルトの名無しさん [sage] 2009/10/09(金) 20:22:11 ID: Be:
    porori 

109 デフォルトの名無しさん [sage] 2009/10/09(金) 20:27:14 ID: Be:
    >>106
    instancemethod, classmethod, staticmethod, property, superとかはぜんぶディスクリプタっていう仕組みで実現されている。

    たとえばメソッドの第一引数にselfが渡されるのもディスクリプタのおかげだし、
    staticmethod関数とかを自作することもできる。

    ふつうは知らなくても問題ないし、知ってても邪悪な黒魔術が使えるだけだけど。 

110 デフォルトの名無しさん [sage] 2009/10/09(金) 22:27:59 ID: Be:
    俺もディスクリプタのおかげで童貞卒業できた 

111 デフォルトの名無しさん [sage] 2009/10/09(金) 22:54:57 ID: Be:
    >>107-109
    サンクス
    漏れは当分ディスクリプタ童貞卒業できなさそうだ 

む、なんだこのディスクリプタって。


関数型プログラミング言語Haskell Part11 
104 デフォルトの名無しさん [sage] 2009/10/09(金) 20:56:47 ID: Be:
    Programming in Haskellの翻訳はいつ出ますか? 

105 デフォルトの名無しさん [sage] 2009/10/09(金) 21:46:22 ID: Be:
    どこからでるんだろね 

■_

2009年10月08日

■_

・台風
いろいろ大変な一日でした。つーか出社するまででほぼ終わっていたようなw 最寄り駅(まで|から)の歩きのときに、 傘をお猪口にしてしまった人を数人目撃したんですが、 中には傘をさしながら自転車に乗っていた人も…何を考えてるんだ? あと、間引き運転になってたので、電車の混み具合がいつもよりひどかったです(早めに出たのに)。 まあ反対側の混み方に比べればましっちゃましでしたが。

・正規表現エンジン
awkのRSが正規表現を受け付けるかどうかという話で思い出したのですが、 ふつー、ある正規表現をある文字列に対してマッチングを試したときに その結果はマッチしたかしなかったかの二択ですよね。 一時期 GNU sed の正規表現エンジンに使われていた rx というライブラリだと、 マッチに失敗したときに、マッチし続けている途中で入力が尽きてしまって そうなったのかという情報が取れたんですよね。たしか。 こういうのがあると、awk の RS みたいなのを正規表現対応にするが楽になるのかなあと 思ったりするのですがどうなんでしょうか(そりゃあ入力を丸呑みするとか、失敗したら 入力の量を増やして頭からリトライとかいう手もあるでしょうけど)。

■_

手っ取り早く C++ のスキルを向上させるにはどんな手があるんでしょうかという お悩み相談。

Software or tools recommended to improve fast your C++ programming skills. - Stack Overflow

List anything you think is great to improve c++ knowledge... Please be concrete when 
giving solutions.

Learning a language that has many different ways to solve the same problem, a wealth 
of undefined behavior, keywords that have multiple context-dependent meanings and an 
ambiguous grammar will never be fast.

Start with Scott Meyer's Effective C++.

Several things to help you improve:

    * Read lots of books (like the one Brad mentioned)
    * Read lots of code
    * Write lots of code
    * Be open to looking at a problem from a new viewpoint

	I would like to add: Continue reading more code.

Spend some time studying the C++ FAQ Lite (or buy the book and read it). Thinking 
about and understanding the answers there has helped me learn a lot about C++.


Thinking in C++ by Bruce Eckel

They are free downloads now: http://www.mindview.net/Books/DownloadSites

A legendary book in my opinion. Eckel is a clear and concise author.

    * First, assess your self, either do a mockup test or something to know where you 
      stand.

    * Take a course in advanced C++. Algorithms, data structures, networking, or any 
      other class where they'll give you a huge project to work on and where you'll be 
      graded on your code, and the knowledge of C++ is expected.

    * buy a Solved problems book for C++, I recommend "how to program C++" 
      (The problems and solutions edition) by Deitel and Dietel. Some might not recommend
      D & D but for your purposes, it's adequate.


(ry)

You might also be able to find some good online courses. MIT's OpenCourseWare site 
might have something useful.

But don't believe anybody if they promise you can start from knowing nothing and 
become a C++ guru in 21 days or something. I've been programming mainly in C++ for 
nineteen years and don't consider myself a guru yet.


As the shoe salesman said: Just Do It.

Simply put, just start coding and you'll soon find out what you need to know. You can 
read all the books in the world, but until you can apply knowledge it's worthless.


1) Daily Read c++ , stl and related tagged question on stackoverflow , Try analyze the 
problems , think of solution , and understand solution given by others

2) :) Start working on C++ in you work , If you have good senior people who do a 
strict code/design review and give valid comments , you will learn c++.

3) Participate on open source projects , Download source and analyze it.

4) Regarding tool : Use source code analyzer like coverity , Lean window debugging 
tools package or something equivalent in unix,

まあ「近道」はないんじゃないっすかねえ。

■_

推薦図書/必読書のためのスレッド 52
26 デフォルトの名無しさん [sage] 2009/10/04(日) 01:11:55 ID: Be:
    気付いたら技術書が段ボール箱で6箱分くらいになったんですが
    これを郵送したらPDF化してCDで返送してくれるサービスってないですかね 

27 デフォルトの名無しさん [sage] 2009/10/04(日) 01:13:16 ID: Be:
    GCはたしか誰かがまとめたwikiがあったはずと思ってブクマ探したらあった
    http://wiki.livedoor.jp/author_nari/d/ 

28 デフォルトの名無しさん [sage] 2009/10/04(日) 01:23:08 ID: Be:
    >>26
    おまいはおれか
    ただコスト的に見合わない商売な気が

    外国みたいに出版社が最初からPDFつきで売ってくれるといいんだけどね
    現品とPDF交換します(古本流通減ってウマー)でもいいけど 

29 デフォルトの名無しさん [sage] 2009/10/04(日) 01:49:02 ID: Be:
    >>26
    俺の家に送るか?w
    俺は裁断してPDFにしてるよ 

30 デフォルトの名無しさん [sage] 2009/10/04(日) 01:50:38 ID: Be:
    >>26
    やってるところ多いぞ 

31 デフォルトの名無しさん [sage] 2009/10/04(日) 01:55:55 ID: Be:
    私的な録画やバックアップすら
    違法にしたくてしょうがない某団体が、
    PDF化なんてゆるさない。 

32 デフォルトの名無しさん [sage] 2009/10/04(日) 01:58:52 ID: Be:
    裁断機で切ってドキュメントスキャナにかければよろしい 

33 デフォルトの名無しさん [sage] 2009/10/04(日) 01:59:58 ID: Be:
    面倒臭いやん 

34 デフォルトの名無しさん [sage] 2009/10/04(日) 02:13:34 ID: Be:
    >>29
    一冊300ページとして何分ぐらいかかるか教えて!
    できれば機材も 

35 デフォルトの名無しさん [sage] 2009/10/04(日) 02:15:12 ID: Be:
    PK-513でググれ 

36 デフォルトの名無しさん [sage] 2009/10/04(日) 02:26:19 ID: Be:
    >>34
    ADF付きの両面スキャン可能なスキャナと強力な裁断機が有ればできるよ
    両方併せて50000円くらい。
    自分の持ってるスキャナはPFUのいっこ前の。本1冊あたり30分くらいかなぁ。 

37 デフォルトの名無しさん [sage] 2009/10/04(日) 02:41:32 ID: Be:
    >>35,36
    サンクス。これからも本とか書類増えるし
    今のうちに導入してみるかなあ 

38 デフォルトの名無しさん [sage] 2009/10/04(日) 02:46:27 ID: Be:
    >>25
    読んでもものにできなかったんだね・・・
    可哀想に 

39 デフォルトの名無しさん [] 2009/10/04(日) 03:10:38 ID: Be:
    本は本だから価値があると思うんだがなあ。 

40 デフォルトの名無しさん [sage] 2009/10/04(日) 03:27:17 ID: Be:
    読むときは紙のほうが便利
    モニタは発光するせいで、どうしても目が疲れる

    ただpdfならかさばらないし、検索ができるからなあ 

41 デフォルトの名無しさん [sage] 2009/10/04(日) 03:28:17 ID: Be:
    >>26
    俺の家に送れ 

42 デフォルトの名無しさん [sage] 2009/10/04(日) 03:41:14 ID: Be:
    検索ができるのは良いよな。あと、自由に注釈やブックマークがつけられる点。
    解体せずにpdfにしようとおもってブックスキャナの値段を調べたらびっくりしたよ 

scansnap とか試してみたいなあ。でもスキャンの段取りとか面倒だなあ(わがまま

■_ 本日の巡回から

2009年10月07日

■_

・たいふうがくる~ものすごいやつ~♪(THE BLUE HEARTS)
大分雨が強くなってきてます。これを書いている時点では風はまだそれほどでもないようですが、 出勤時にはどうなっていることやら。 ああ、いっそ休んでしまおうか。

・ねた
Tokyu..b でなんかできないもんか思案投げ首。

・ファイターズ優勝おめでとうございます
北海道在住の某氏に(笑)

■_ すきなげんごのきらいなところ

なんのかんの言いつつ、今回も面白そうなのをピックアップしてしまうのだった。 今回はスルーしましたけど、Haskell ネタも結構目立っていたような印象があります。



What do you hate most in your favourite programming language? : programming

Ruby: No ++ or -- operator. Hey I'm a simple guy with simple annoyances.

I still really hate join being a string method instead of a list method in Python. So instead of

['this','is','good.'].join(' ')

you have to do

' '.join(['this','is','bad.'])



Ruby: The community and how constructors do not use the class name, it instead uses 
"initialize".

Python

def __init__(self, param1):


if __name__=='__main__':

Extending the constructor is especially inconvenient:

def __init__(self, arg, *args, **kwargs):
    super(MyClass, self).__init__(*args, **kwargs)
    self.dosomething(arg)

So much boilerplate...

Java:

    * getters and setters. Can't believe they haven't found a way to bypass the 
      default declaration of these things.
    * catch blocks can't see vars declared in the corresponding try blocks
    * maps and lists don't have literals
    * generics are so out of control that class declarations aren't even readable anymore
    * annotations used as configuration...that's not modifiable post-compilation
    * JSF and swingified web frameworks
    * JSPs and especially the EL

My favorite languages are APL and J.

I hate that there are no good open source interpreters for either of them. Just 
proprietary interpreters that are crazy expensive for commercial use and 
free-but-closed-source for personal use. I think this goes a long way to choking the 
development communities of APL and J.

Technically, there is an open source interpreter for an APL variant called A+, but 
it's flaky as hell.

なんだ Ruby の「comunity」って。 Python の join はやっぱり気に入らない人いるんですね。

■_

Perlについての質問箱 41箱目 
700 デフォルトの名無しさん [sage] 2009/10/03(土) 23:25:10 ID: Be:
    正規表現でマッチした文字列そのものを取得したいです

    例えば
    "hoge huga" =~ /(\s|\d)/
    という正規表現があったとき、
    ' 'ではなく'\s'を取得したいです

    可能でしょうか 

701 ◆TWARamEjuA [sage] 2009/10/03(土) 23:30:31 ID: Be:1307243-BRZ(10101)
    可能でしょうねぇ。。。 

702 デフォルトの名無しさん [] 2009/10/03(土) 23:36:15 ID: Be:
    700じゃないけど、どうすればできるか知りたい。
    役に立つ気はしないけど。 

703 デフォルトの名無しさん [sage] 2009/10/03(土) 23:46:01 ID: Be:
    (?{})とか(??{})を駆使すればいけるかもしれないけど
    デフォでそんなインターフェイスは用意されてないっしょ 

704 デフォルトの名無しさん [sage] 2009/10/04(日) 00:03:31 ID: Be:
    >>703
    ??{}ですか
    参考になりました、調べてみますね
    ありがとうございました 

705 デフォルトの名無しさん [sage] 2009/10/04(日) 00:03:35 ID: Be:
    おれも知りたい。 

706 700 [sage] 2009/10/04(日) 01:55:44 ID: Be:
    こういう感じで元の文字列を取ることができました
    ありがとうございます

    perl -e '
    use re "eval";
    $hoge = q/ho..(?{$str="ho.."})|hu..(?{$str="hu.."})/;
    "huga" =~ /$hoge/;
    print "1:$str\n";
    "hoge" =~ /$hoge/;
    print "2:$str\n";
    '
    1:hu..
    2:ho..

    やりたかったのは
    %hash = (
       '\s+' => 'space',
       '\d+' => 'number',
       '\w+' => 'word',
    );

    という感じのハッシュのキーを合成して、一番最初にマッチしたものの名前を返す関数の作成だったので、
    これでいけそうです

707 700 [sage] 2009/10/04(日) 03:45:43 ID: Be:
    なんか変にハマったのでもう一度質問させてください。。。
    下のような関数を作りました

    sub match($@){
       use strict;
       use re "eval";
       my $str = shift;
       my @member = @_;

       my $regex = join("|", map{ "$_(?{\$ret = q{$_}})"} @member);
       my $ret;
       $str =~ /$regex/;
       return $ret;
    }

    以下の呼び出しを行うと、

    print match("hoge 123", qw(\d \w \s)), $/; #=> \w
    print match(" 123hoge", qw(\d \w \s)), $/; #=>
    print match("123 hoge", qw(\d \w \s)), $/; #=>

    となり、思った結果を返してくれませんでした
    ですが、match関数に渡す配列の順番を変えたところ、

    print match("hoge 123", qw(\d \w \s)), $/; #=> \w
    print match(" 123hoge", qw(\w \d \s)), $/; #=> \s
    print match("123 hoge", qw(\d \w \s)), $/; #=> \d

    と、期待通りの結果を返してくれました
    これは一回通った正規表現に対してはサブパターンは呼び出されないということなんでしょうか。。。 

708 デフォルトの名無しさん [sage] 2009/10/04(日) 04:32:58 ID: Be:
    レキサ作ってんのか。。。 

709 デフォルトの名無しさん [sage] 2009/10/04(日) 10:06:58 ID: Be:
    >>707
    >>706のレス見たときに、関数化してハマるんだろうなーと思ったらマジでハマっててワロタ

    my $regex → local our $regex
    my $ret → local our $ret
    これでどうかな?
    昔、そういうプロギラムを書いていたときには、こいつで回避出来たよ

    多分、正規表現リテラルは初回の正規表現コンパイル時に、クロージャのようにローカル環境をキャプチャするけど
    再度、同じ正規表現を与えてリテラルのパスを通ってもキャプチャが発生しない
    なので、正規表現の中ではmy変数は使わず、グローバル変数を使えばOKと 

710 700 [sage] 2009/10/04(日) 14:05:04  ID: Be:
    >>709
    おお!いけました!
    ありがとうございます

    use strictすることでこんな罠が生まれていたとは思いもしませんでした
    正規周りは魔物が住んでますね…

正規表現を略して「正規」とか勘弁してください ○| ̄|_



プログラミング言語、いくつ使える? [chaika]
76 デフォルトの名無しさん [sage] 2009/09/30(水) 22:07:06 ID: Be:
    これは衝撃を受けたって言語はあるかい。
    VB、delphi、C、C++、C#、python、ruby、ちょっと違うけど正規表現と俺は毎回衝撃受けてるよ。 

77 デフォルトの名無しさん [sage] 2009/09/30(水) 23:14:18 ID: Be:
    >>sage
    VHDLかな…
    それまで完全にソフト屋だったから、衝撃あった 

78 デフォルトの名無しさん [sage] 2009/10/01(木) 03:34:26 ID: Be:
    衝撃って言ったらSchemeとPrologだな。
    76に挙げられてる言語がみんな似たような言語に見える。 

79 デフォルトの名無しさん [sage] 2009/10/01(木) 05:40:40 ID: Be:
    俺はHaskellぐらいだな……
    CもJavaもPythonもなんか書きやすいなって感じしか受けなかったし、
    PrologとかLispも変わってるなーって印象しかなかった。

    それに比べるとHaskellは本当に目から鱗だったので。 

80 デフォルトの名無しさん [] 2009/10/02(金) 00:42:42 ID: Be:
    Perl
    これで済むのか!?って思った 

81 デフォルトの名無しさん [] 2009/10/02(金) 06:56:10 ID: Be:
    あれができる、これができる、て言って自慢する奴が時々いるよね。実際やらせると死ぬほどレベル低い。
    やり直しさせようとすると言い訳しまくり。最後は逆ギレ。
    そういうのを見てきて、「できる」というのは、完全には無理でも大体は知り尽くしてからにしようと思うようになった。
    なので、C。C++は少しできる。 

85 デフォルトの名無しさん [sage] 2009/10/02(金) 13:41:28 ID: Be:
    C++のtemplateがチューリングコンプリートだとわかったときは衝撃だったなぁ 

86 デフォルトの名無しさん [sage] 2009/10/03(土) 01:56:35 ID: Be:
    最初に覚えたのはC、C++
    画像処理プログラミングでこれがメジャーだったからね。
    さらにホームページ作成でHTML/JavaScript
    Ajaxツールキットで遊びまくったおかげでJavaScriptは覚えたな。
    次に、COBOL
    会社の研修で軽く扱ったが、糞言語だったわ。
    そして開発プロジェクトでJAVA
    基本的にC++と似ていたが、ポインタを意識しなくてよかったのは衝撃。
    VB.netでの開発にも携わって、この言語も習得したが書き方が一番むかつく。
    んで最近のマイブームはVBScript
    一般的に流行ってないのが残念すぎる。

87 デフォルトの名無しさん [sage] 2009/10/03(土) 02:11:51 ID: Be:
    >>86
    続きキボンヌ 

88 デフォルトの名無しさん [sage] 2009/10/03(土) 07:57:13 ID: Be:
    こういう流れだったら次はPythonのような気がする
    俺がそうだったし 

89 デフォルトの名無しさん [sage] 2009/10/03(土) 11:13:49 ID: Be:
    >>88
    だが昔のperlコードの保守をやらされて絶望する

90 デフォルトの名無しさん [] 2009/10/03(土) 15:06:22 ID: Be:
    Pythonは去年の言語。今は斜陽。

    今年はCが来ている。 

91 デフォルトの名無しさん [sage] 2009/10/03(土) 15:22:12 ID: Be:
    正直HaskellもML知ってる後だと衝撃はなかったな
    やっぱりPrologとSmalltalkかな 

92 デフォルトの名無しさん [] 2009/10/03(土) 20:27:01 ID: Be:
    CとC++使えたら他覚えるの簡単かな? 

93 デフォルトの名無しさん [sage] 2009/10/03(土) 20:38:05 ID: Be:
    「構造化プログラミングできる」
    「オブジェクト指向できる」
    「関数オブジェクト使える」までもっていければ、
    他の言語覚えるのは簡単とは言わんが、とっかかりぐらいにはなるかなぁ……。 

94 デフォルトの名無しさん [sage] 2009/10/03(土) 20:38:32 ID: Be:
    >>92
    Algol系ならな。

95 デフォルトの名無しさん [] 2009/10/03(土) 21:55:54 ID: Be:
    >>92
    そうだね。 

96 デフォルトの名無しさん [sage] 2009/10/03(土) 22:24:54 ID: Be:
    すぐ覚えれる。
    プログラム言語なんて結局おなじやもん。 

97 デフォルトの名無しさん [sage] 2009/10/03(土) 22:28:07 ID: Be:
    マシン語書ける奴が勝ち組 

98 デフォルトの名無しさん [sage] 2009/10/04(日) 00:10:21 ID: Be:
    nop 

99 デフォルトの名無しさん [] 2009/10/04(日) 01:02:46 ID: Be:
    halt 

halt が来たということでお後がよろしいようで。

■_ 本日の巡回から

2009年10月06日

■_

・正解
一部で盛り上がった? 等差数列の合計を求める的なアレですが、 わたしがきになったのは「これが正解」というような書き方をしていたことです。 それは、出題者が求めていた解答(回答)ではあるでしょうけれども、 それをもって正解というのはいいすぎじゃないかなあと。 まあわたしが気にしすぎなんでしょうが。

・戦う司書DVD
9巻まで発売予定があるということは、2クールものなんでしょうか。

・awk の RS と FS
FS はどのawkでも問題なく正規表現を放り込めますが、RSは違いますよ~。 mawk は使えますけど。

■_ Sprixel

perlsix のアナグラムからつけられた名前なんだとか。

blog | Perlgeek.de :: Sprixel, a 6 compiler powered by JavaScript
Sprixel, a 6 compiler powered by JavaScript

Permanent link

Today I want to announce sprixel, a new Perl 6 compiler in its early stage of 
development, written in JavaScript and using the standard Perl 6 grammar STD.pm.

・名前が sprixel という新しい Perl 6 コンパイラー
・まだ開発の初期段階
・JavaScript で記述されている
・Perl 6 の構文として STD.pm を使っている

Sprixel (an anagram of perlsix) development was initiated by Matthew Wilson, aka 
diakopter. It traverses the Abstract Syntax Tree as produced by STD.pm, transforms it 
into an intermediate JavaScript data structure similar to JSON (but with some 
enhancements to handle cyclic structures), and has a small, continuation based runloop 
that executes the JavaScript. Currently the only backend is the V8 compiler and 
virtual machine - but if/when the STD grammar is implemented, you'll be able to run 
Perl 6 in your browser.

・Perl 6のプログラムを ASTに変換し、それをさらにJavaScriptに。

Currently sprixel supports scalar and list variables, numbers (including bigint), 
strings, string interpolation, basic control flow, closures, named sub declaration 
(with parameters), and map.

・現状でサポートされているもの

Sprixel development is optimized for fun, and already picked up some contributors 
(notably, mberends implemented many infix operators, a makefile, and a test harness). 
The source code can be found in the pugs repository (but is completely independent of 
the pugs compiler project). The main communication medium so far has been the #perl6 
IRC channel on irc.freenode.net.

Motivation

Why yet another Perl 6 implementation? you might ask. A few reasons actually:

    * Sprixel exercises STD.pm, which so far is mostly tested only for parse successes 
      or failures. Relying on the underlying AST structure in a real compiler helps to 
      reveal tricky bugs and unnecessarily difficult interfaces.

    * Most existing Perl 6 compilers either implement only a minimal subset of Perl 6, 
      or rely heavily on a rather large stack of underlying software, thus making 
      substantial contributions non-trivial.

    * Implementing a compiler helps one to understand the language better.

■_ R

yhara さんが、RがSchemeで実装されるのって本当なのかという疑問を ついったでつぶやいていたのでちょっと調べてみました。 まずはソースアーカイブを展開して、そこに含まれているファイルの拡張子ごとに数を数えてみます。

>dir /b /s | grep -o -e "\.[^.\\]*$" | sortf | uniq -c | sortf -r

   1276 .Rd
    718 .R
    511 .c
    170 .po
    167 .h
    149 .mo
     97 .in
     87 .afm
     45 .win
     45 .f
     42 .save
     23 .gmo
     20 .pot
     19 .pdf
     18 .enc
     14 .html
     13 .m4
     13 .Snw
     12 .lnk
     12 .gz
     11 .tcl
     10 .texi
     10 .rc
     10 .pm
      8 .pl
      8 .class
      7 .txt
      7 .mk
      7 .java
      6 .tab
      6 .eps
      5 .sh
      5 .jpg
      5 .fd
      5 .def
      5 .R~
      4 .isl
      4 .css
      4 .Rd~
      3 .sty
      3 .rda
      3 .manifest
      2 .y
      2 .tex
      2 .site
      2 .sin
      2 .sed
      2 .hide
      2 .header
      2 .db
      2 .csv
      2 .bmp
      2 .S
      2 .Rin
      2 .1
      2 .0

2個以上ソースアーカイブ中に現れる拡張子を抜き出してみました。 Scheme っぽいのは見当たらないですねえ。 あと、一位の .Rd ですが

% File src/library/stats/man/ave.Rd
% Part of the R package, http://www.R-project.org
% Copyright 1995-2007 R Core Development Team
% Distributed under GPL 2 or later

\name{ave}
\title{Group Averages Over Level Combinations of Factors}
\usage{
ave(x, \dots, FUN = mean)
}
\alias{ave}
\arguments{
  \item{x}{A numeric.}
  \item{\dots}{Grouping variables, typically factors, all of the same
    \code{length} as \code{x}.}
  \item{FUN}{Function to apply for each factor level combination.}
}
\description{
  Subsets of \code{x[]} are averaged, where each subset consist of those
  observations with the same factor levels.
}
\value{
  A numeric vector, say \code{y} of length \code{length(x)}.
  If \code{\dots} is \code{g1,g2}, e.g.,
  \code{y[i]} is equal to \code{FUN(x[j]}, for all \code{j} with
  \code{g1[j] == g1[i]} and \code{g2[j] == g2[i])}.
}
\seealso{\code{\link{mean}}, \code{\link{median}}.}
\examples{
require(graphics)

ave(1:3)# no grouping -> grand mean

attach(warpbreaks)
ave(breaks, wool)
ave(breaks, tension)
ave(breaks, tension, FUN = function(x)mean(x, trim=.1))
plot(breaks, main =
     "ave( Warpbreaks )  for   wool  x  tension  combinations")
lines(ave(breaks, wool, tension            ), type='s', col = "blue")
lines(ave(breaks, wool, tension, FUN=median), type='s', col = "green")
legend(40,70, c("mean","median"), lty=1,col=c("blue","green"), bg="gray90")
detach()
}
\keyword{univar}

ということで、マニュアル向けのドキュメントフォーマットのようです。 そしてソースコードがどんな具合かというと

src/main/apply.c
/*
 *  R : A Computer Language for Statistical Data Analysis
 *  Copyright (C) 2000-7  the R Development Core Team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, a copy is available at
 *  http://www.r-project.org/Licenses/
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <Defn.h>

/* .Internal(lapply(X, FUN)) */

/* This is a special, so has unevaluated arguments.  It is called from a
   closure wrapper, so X and FUN are promises. */

SEXP attribute_hidden do_lapply(SEXP call, SEXP op, SEXP args, SEXP rho)
{
    SEXP R_fcall, ans, names, X, XX, FUN;
    int i, n;
    PROTECT_INDEX px;

    checkArity(op, args);
    PROTECT_WITH_INDEX(X = CAR(args), &px);
    PROTECT(XX = eval(CAR(args), rho));
    FUN = CADR(args);  /* must be unevaluated for use in e.g. bquote */
    n = length(XX);
    if (n == NA_INTEGER) error(_("invalid length"));

    PROTECT(ans = allocVector(VECSXP, n));
    names = getAttrib(XX, R_NamesSymbol);
    if(!isNull(names)) setAttrib(ans, R_NamesSymbol, names);

    /* The R level code has ensured that XX is a vector.
       If it is atomic we can speed things up slightly by
       using the evaluated version.
    */
    {
	SEXP ind, tmp;
	/* Build call: FUN(XX[[<ind>]], ...) */

	/* Notice that it is OK to have one arg to LCONS do memory
	   allocation and not PROTECT the result (LCONS does memory
	   protection of its args internally), but not both of them,
	   since the computation of one may destroy the other */

	PROTECT(ind = allocVector(INTSXP, 1));
	if(isVectorAtomic(XX))
	    PROTECT(tmp = LCONS(R_Bracket2Symbol,
				LCONS(XX, LCONS(ind, R_NilValue))));
	else
	    PROTECT(tmp = LCONS(R_Bracket2Symbol,
				LCONS(X, LCONS(ind, R_NilValue))));
	PROTECT(R_fcall = LCONS(FUN,
				LCONS(tmp, LCONS(R_DotsSymbol, R_NilValue))));

	for(i = 0; i < n; i++) {
	    INTEGER(ind)[0] = i + 1;
	    SET_VECTOR_ELT(ans, i, eval(R_fcall, rho));
	}
	UNPROTECT(3);
    }

    UNPROTECT(3); /* X, XX, ans */
    return ans;
}

static SEXP do_one(SEXP X, SEXP FUN, SEXP classes, SEXP deflt,
		   Rboolean replace, SEXP rho)
{
    SEXP ans, names, klass, R_fcall;
    int i, j, n;
    Rboolean matched = FALSE;

    /* if X is a list, recurse.  Otherwise if it matches classes call f */
    if(isNewList(X)) {
	n = length(X);
	PROTECT(ans = allocVector(VECSXP, n));
	names = getAttrib(X, R_NamesSymbol);
	/* or copy attributes if replace = TRUE? */
	if(!isNull(names)) setAttrib(ans, R_NamesSymbol, names);
	for(i = 0; i < n; i++)
	    SET_VECTOR_ELT(ans, i, do_one(VECTOR_ELT(X, i), FUN, classes,
					  deflt, replace, rho));
	UNPROTECT(1);
	return ans;
    }
    if(strcmp(CHAR(STRING_ELT(classes, 0)), "ANY") == 0) /* ASCII */
	matched = TRUE;
    else {
	PROTECT(klass = R_data_class(X, FALSE));
	for(i = 0; i < LENGTH(klass); i++)
	    for(j = 0; j < length(classes); j++)
		if(Seql(STRING_ELT(klass, i), STRING_ELT(classes, j)))
		    matched = TRUE;
	UNPROTECT(1);
    }
    if(matched) {
	/* PROTECT(R_fcall = lang2(FUN, X)); */
	PROTECT(R_fcall = lang3(FUN, X, R_DotsSymbol));
	ans = eval(R_fcall, rho);
	UNPROTECT(1);
	return(ans);
    } else if(replace) return duplicate(X);
    else return duplicate(deflt);
}

確かに Lisp (Scheme)っぽさがところどころにありますが、 Scheme で実装されてるとか、Emacs みたいに二段階(CでLispインタープリターと 最低限のプリミティブを実装、それを使ってエディターを構築)というわけでもなさそうです。

■_



推薦図書/必読書のためのスレッド 51
946 デフォルトの名無しさん [] 2009/10/03(土) 02:33:21 ID: Be:
    プログラミングは初めてなんですがC#をやってみたいので、おすすめの書籍を教えてください。
    本屋で立ち読みした限りでは、
    独習やオライリーのは、ちょっと取っつきづらく感じました。
    矢沢久雄 著 標準C#入門
    http://www.amazon.co.jp/dp/4797347082/
    が読みやすかったです。
    次点が、猫でも~のC#本です。
    初心者向けのC#講座サイトがあればいいんですが、
    猫でも以外は、プログラミング初心者向けじゃないような感じを受けました。 

947 デフォルトの名無しさん [sage] 2009/10/03(土) 02:38:29 ID: Be:
    C#の絵本
    http://www.amazon.co.jp/dp/4798114618/ 

948 デフォルトの名無しさん [sage] 2009/10/03(土) 02:38:39 ID: Be:
    立ち読みしてよかったんならそれ買えば? 

949 デフォルトの名無しさん [sage] 2009/10/03(土) 02:49:40 ID: Be:
    つか、立ち読みに勝るものなし。本屋に足運べ。
    ネットの評判なんて当てにならん上に工作員とか信者とかいるし、
    現物見ないでああだこうだ言っても的外れな妄想が膨らむだけ 

950 デフォルトの名無しさん [sage] 2009/10/03(土) 02:52:18 ID: Be:
    >>947
    絵本はちょっとやさしすぎますね。
    わかりやすいんですが、手元に置いておくにはちょっと。
    >>948
    3千円近い買い物になるので、一応、別に良い物があったら図書館で取り寄せして
    見てみようと思いまして。(秋葉原行った方が早いかも)

    ちなみに、C言語のほうでとても読みやすかったのは倉薫 著 C言語1と2です。 

951 デフォルトの名無しさん [sage] 2009/10/03(土) 02:59:02 ID: Be:
    何故やさしすぎるといけないんだ?全く意味不明。
    無意味に苦労したいドSなの? 

952 デフォルトの名無しさん [sage] 2009/10/03(土) 03:00:52 ID: Be:
    訳わからん
    結局どういうのが欲しいんだよ 

953 デフォルトの名無しさん [sage] 2009/10/03(土) 03:02:34 ID: Be:
    自分がいいと思った本があるのにそれを買わずに、2chで薦められた本を買うのか 

954 デフォルトの名無しさん [sage] 2009/10/03(土) 03:02:36 ID: Be:
    ムヅカシイ本を読めるオレを堪能したいんだろ 

956 デフォルトの名無しさん [sage] 2009/10/03(土) 03:07:15 ID: Be:
    >>949
    それじゃあ時間を取って秋葉原に行ってみます。
    >>951-954
    取っつきやすい本で、ある程度プログラムが組めるような段階になったら、
    リファレンスとしても使えるような書籍が欲しいんです。
    取っつきやすいかどうかは、やっぱり立ち読みじゃないとわかりませんね。 

963 デフォルトの名無しさん [sage] 2009/10/03(土) 03:43:19 ID: Be:
    >>956
    独習でいいよ。
    猫でも-、も矢沢も品質劣悪だから。 

966 デフォルトの名無しさん [sage] 2009/10/03(土) 10:01:24 ID: Be:
    独習はちょっと・・・ 

967 デフォルトの名無しさん [sage] 2009/10/03(土) 10:16:08 ID: Be:
    本屋で立ち読みして気に入った本があれば、とりあえず
    それ使ってみれば良いんじゃないかな。
    どんな本でも使っていったら必ず足らないところがいろ
    いろ見えてくるから、その都度吟味して購入していけば良い。
    猫は読みやすいけどそこを意識し過ぎてて、内容は悪く
    ないんだけど、全体的にサラッと流しすぎてる感じはする。 

970 デフォルトの名無しさん [sage] 2009/10/03(土) 11:18:46 ID: Be:
    洋書以外買っても意味無いから
    悩むなよw 

■_ 本日の巡回から

あとでよむ

10 Years of Virtual Machine Performance (Semi) Demystified | Engine Yard Blog
http://www.engineyard.com/blog/2009/10-years-of-virtual-machine-performance-semi-demystified/

http://haskell.g.hatena.ne.jp/taninsw/20091005/p1

nothingmuch's perl blog: Are Filehandles Objects?
http://blog.woobling.org/2009/10/are-filehandles-objects.html
  
  

2009年10月05日

■_

・ノモンハン戦争
ノモンハン戦争―モンゴルと満洲国 (岩波新書)
読んだ。 歴史の教科書などでは「ノモンハン事件」と称されますが、本書では「~戦争」 としています。本の冒頭をはじめ、その理由は読めば書いてあります。 なぜ「戦争」と呼ばないのか、呼べないのか. それにしても辻正信や源田実(こちらはノモンハンには関係ありませんが)といった人たちが なんの裁きも受けず、国会議員にもなってしまうというのは一体どういうことなんでしょうか。

・なんかねー
最近勧誘の電話が良くかかってくるんですわ。「資産形成のためにマンション買いませんか」 とか「お墓を~」とか。ここ十年くらいご無沙汰だったのになあ。

■_ from ム板(とそれ以外)

スレ立てるまでもない質問はここで 100匹目
892 デフォルトの名無しさん [] 2009/10/03(土) 00:14:05 ID: Be:
    (´・ω・`)ぬるぽ 

893 デフォルトの名無しさん [sage] 2009/10/03(土) 01:24:42 ID: Be:
    じゃあ俺も(´・ω・`)ぬるぽ 

894 デフォルトの名無しさん [sage] 2009/10/03(土) 01:28:18 ID: Be:
    (´・ω・`)なるぽ? 

895 デフォルトの名無しさん [sage] 2009/10/03(土) 01:29:10 ID: Be:
    >>895-895
    ガッ 

なるぽ。んー、なんか良いなw


統計解析フリーソフト R 【第3章】
415 132人目の素数さん [] 2009/09/02(水) 21:30:57 ID: Be:
    ちょいと質問。

    変数の型が途中で変えられるのに非常に違和感を感じます。
    C言語なんかでは不可能です。
    関数が値渡しだからかのう???
    頭が整理されていないので、チンプンカンプンな質問になっていますが、
    どなたかご説明いただけますか?


    x <- c(2,2,3,1,5)
    x <- factor(x)

    ↑numericがfactorに!

416 132人目の素数さん [] 2009/09/02(水) 22:19:50 ID: Be:
    >>415
    Rは型安全じゃないし動的型だから。
    違和感を感じるって言われても困るから。 

417 132人目の素数さん [sage] 2009/09/03(木) 01:08:18 ID: Be:
    >>416
    ググル為のキーワードを下さい。

418 132人目の素数さん [sage] 2009/09/03(木) 10:37:22 ID: Be:
    >>415
    別の変数を同じ変数名で上書きができると考えたらいいんじゃね?
    x <- c(2,2,3,1,5)
    y <- factor(x)
    としたとき、xとyは別々の変数だけど、
    x <- y
    として、yをxで上書きできる。
    y <- factor(x); x <- y
    を1文にすると、
    x <- factor(x)
    となる。

    >>415が言っている論法だと、
    > x <- c(2,2,3,1,5)
    > x <- function(i){return(i+1)}
    > class(x)
    [1] "function"
    ↑numericがfunctionに!

    と言っているのと大差がない。



419 418 [sage] 2009/09/03(木) 10:45:18 ID: Be:
    ちょっと訂正。変数の型の話をするときには、class()ではなくmode()を使うべきだった。
    結果と結論は同じだけど。 

420 132人目の素数さん [sage] 2009/09/03(木) 20:23:26 ID: Be:
    >>415
    ttp://www.okada.jp.org/RWebRef/R-lang.jp.v110.html
    これによると、Cソース上ではRのオブジェクトはSEXPRECへのポインタ*SEXP。
    定義は、src/include/Rinternals.h にある、
    SEXPREC {
     SEXPREC_HEADER;
     union {
      struct primsxp_struct primsxp; (略)
     } u;
    } SEXPREC, *SEXP;
    マクロSEXPREC_HEADERを追っていくと、全てのR上の変数をenumしている、
    SEXPTYPE に行き着く。ココに変数のR上での型を入れてあるようだ。
    Rの変数は全てオブジェクトらしいから、genericな型としてSEXPを使っている
    のでは?generic型のやり取りになるから、全ての変数を入れ替え可能となる。
    ちゃんと読んでないから知らんけど。 

421 132人目の素数さん [sage] 2009/09/04(金) 08:42:44 ID: Be:
    RってScheme上に実装されているんじゃなかったっけ?

    もしそうなら、Schemeの変数ってCのvoid *見たいなもんだから、型が変わるとかそもそも意味が無い。
    (Schemeでは、値には型があるが変数には型は無い) 

これはそれ以前にやってたプログラミングのスタイル(と言語)で変わりそうな。

■_ 自己啓発

とはちょっと違うか。


3 Sets of Programming Exercises to Polish Your Skills

3 Sets of Programming Exercises to Polish Your Skills

9 Sep, 2009  Developers

Yesterday at the last URUG meeting, one of the presenters talked to us about Ruby 
threading and then got us started on an exercise building a chat server using 
threading. The exercise was enlightening and really cemented the concepts for a lot of 
the people there. So, I thought I'd share three sites that provide programming 
exercises to help you become a better programmer.

last URUG meeting が行われた昨日のことですが、プレゼンターの一人が Ruby threading につ
いて話し始め、それからわたしたちの間でthreding を使ったチャットサーバーの構築の 
exercise についての話題になりました。
The exercise was enlightening and really cemented the concepts for a lot of the people there.
そこで、あなたがより良いプログラマーになるのを手助けしてくれる
programming exercises を提供している三つのサイトを紹介します。

Project Euler (プロジェクトオイラー)

Project Euler is a series of math problems you can solve with programming. I've 
solved 25 of them so far and have my solutions on github. I prefer that you don't 
look at the solutions until you've solved them yourself. If you'd like to discuss 
the solutions you got or the solutions I built, feel free to email me.

Project Euler (プロジェクト オイラー) はプログラミングを行って解くことのできる数学の問
題集です。わたしはここまで二十五問解いて、自分の解答を github に置いています。あなたが
自分自身で答えを出してみるまではこれを見ないことをお勧めします。もしあなたが自分の出し
た解答だとかわたしに解答について議論したいと思ったら気兼ねなくメールしてください。

RubyQuiz

RubyQuiz ran for about 3 years under the direction of James Edward Gray II. Since he 
stopped doing it, it's now posted on the Ruby Talk mailing list. The problems are 
generally intermediate with a few exceptions.

RubyQuiz は James Edward Gray II の指揮の下、およそ三年ほど続きました。彼は更新作業を
止めてしまったので、現在は ruby-talk メーリングリストに投稿されています。出題される問
題は一部に例外はありますが generally intermediate なものです。

Code Kata

Dave Thomas of pragmatic programmers developed the idea of Code Kata. These are 
exercises that are designed to be repeated and the practices behind the exercises 
perfected. I've seen a few demonstrated and will be posting my solutions on my github 
account.

pragmatic programmers の Dave Thomas は Code Kata (コード型) のアイデアを考えつきました。
この Code Kata とは繰り返し行うように design されていて
practices behind the exercises perfected な稽古 (exercises) です
I've seen a few demonstrated and will be posting my solutions on my github account.

Overall, practice makes perfect. It's one thing to read about programming principles 
and practices and another to implementing. Good luck with these solutions. Feel free 
to post your solutions or links to them in the comments.

全般的に言って practice makes perfect します。プログラミング上の原則 (programming 
principles) や practices について読んだりするためともう一つは実装のためです。

Good luck with these solutions.
Feel free to post your solutions or links to them in the comments.

Copyright c Charles Max Wood | WordPress | Tigopedia Reloaded 2.0

■_ カルチャーショック?

びっくりコード
びっくりコード

BOOL
someFunction(ptr)
void **ptr;
{
    // いろいろやっているのは省略
    // こんなに短くはない。
    // 短くないからこそ、余計に?なんだけど。
    // でも、そこまで書くのは疲れるし。
    // 読むほうも大変だろうから、
    // この辺でやめておく。
    // とにかく、この、最後の行だけを、
    // 見てしまったと思ってください。

    return !!*p;
}

コメント

    * このプロジェクトの引継ぎだけは、ご免被りたいですね。。

    * 私としては「!!xに違和感を感じない」と言いきってしまう事自体に違和感を覚えます

「違和感覚える」ほど変態なコードじゃないと思うがねえ。 それなりに知られたイディオム(テクニック)じゃなかろか。 「マイナー(=あまり使われない)であろうテクニックだからちょっと面食らった」 くらいならわからんでもないけど。

■_ 這いよる混沌

確かもうすぐ3巻が発売になる予定なので。

【這いよれ! ニャル子さん】 逢空万太3 【GA文庫】 
362 イラストに騙された名無しさん [sage] 2009/09/14(月) 13:50:19 ID:vfELqc6Z Be:
    >>355
    こんなの?

    「私のターン!ドロー!『身の毛もよだつおぞましき黒い悪魔』を攻撃表示で召喚します!
     ククク、これは一度場に召喚できれば、どのような手段で破壊されても
     30回まで墓地から呼び戻す事ができるチートなカード!」
    「…場に伏せたトラップカード発動、『強力粘着Gホーム』。このカードの効果により
     ニャル子の『身の毛もよだつおぞましき黒い悪魔』は私の場で行動不能となる」

    十年以上前にどこかで『アレ』は北海道にはいない
    と聞いたが都市伝説の類だろうか?
    西日本在住だとわからん 

363 イラストに騙された名無しさん [sage] 2009/09/14(月) 14:08:59 ID:H+J2yrk7 Be:
    >>362
    北海道全域に全く存在しないというわけではないが、一般家庭で目にする機会は殆どない
    北陸や長野も似たような地域が多い 

364 イラストに騙された名無しさん [sage] 2009/09/14(月) 16:37:29 ID:FSIbTV0/ Be:
    私北海道在住だけど生まれてまだ一度も実物みたことないな 

365 イラストに騙された名無しさん [sage] 2009/09/14(月) 16:38:39 ID:M29IkrZ2 Be:
    本州からの転勤族の家だといる確率は高いぞ。
    冬でも24時間暖かい北海道の家屋では、むしろ北陸長野よりも根絶は難しい。
    あと、繁華街の雑居ビルや大きなペットショップには普通にいるな。

    ただし、いずれにしても小物ばかりだ。 

366 イラストに騙された名無しさん [sage] 2009/09/14(月) 17:02:07 ID:cotb7hC4 Be:
    南のアレはもう別の蟲だ 

367 イラストに騙された名無しさん [sage] 2009/09/14(月) 17:07:53 ID:qJztUvjR Be:
    いつもカサカサあなたの隣に這いよる混沌 

368 イラストに騙された名無しさん [sage] 2009/09/14(月) 17:27:12 ID:NFmyKa6F Be:
    そいつも火とは相性悪そうだな 

371 イラストに騙された名無しさん [sage] 2009/09/14(月) 18:30:13 ID:e9kZUa0R Be:
    適当にwikiったら世界には羽根を広げると20センチクラスのGがいることを知った
    あああああああああああ、窓に!窓に! 

373 イラストに騙された名無しさん [sage] 2009/09/14(月) 18:54:58 ID:UmOpsXe+ Be:
    俺も生まれてから一度も見たこと無いな
    関東に五年ほど住んでたときも遭遇しなかったけど 

375 イラストに騙された名無しさん [sage] 2009/09/14(月) 19:53:35 ID:XjeJ15FK Be:
    オマエラ、微妙に汚染されてきていないか? 

376 イラストに騙された名無しさん [sage] 2009/09/14(月) 19:55:20 ID:A/cdWq8d Be:
    これからが本当の地獄だ 

377 イラストに騙された名無しさん [sage] 2009/09/14(月) 20:05:30 ID:vfELqc6Z Be:
    はじめは軽い気持ちだったんです
    それがまさかこんなに話が膨らむとは……
    罪なので罰として膨れ女に脳味噌チュルチュルされてくる 

378 イラストに騙された名無しさん [sage] 2009/09/14(月) 20:25:01 ID:wrzAkkx6 Be:
    よし、いい傾向だ 

388 イラストに騙された名無しさん [sage] 2009/09/15(火) 14:43:52 ID:flKNGp+O Be:
    しばらくスレみてなかったけどなんでゴキブリの話になってんだ? 

389 イラストに騙された名無しさん [sage] 2009/09/15(火) 14:48:14 ID:fOpOZm4m Be:
    出会えばSAN値が下がる混沌の眷属だから 

390 イラストに騙された名無しさん [sage] 2009/09/15(火) 15:42:20 ID:8T0op/+L Be:
    ゴキブリ見るたび正気度下がってたら、南国生まれの人とかみんないあいあいってそうだな 

391 イラストに騙された名無しさん [sage] 2009/09/15(火) 16:58:02 ID:ASgKg2x2 Be:
    南国の人にとってはただの虫 

392 イラストに騙された名無しさん [sage] 2009/09/15(火) 17:52:25 ID:1sxc/ihc Be:
    流石に素足で靴の中に潜んでたGを踏み潰したときは悲鳴を上げた 

393 イラストに騙された名無しさん [sage] 2009/09/15(火) 18:55:02 ID:hcd5jRat Be:
    クトゥルフ本スレから流れてきてる人がいるな 

397 イラストに騙された名無しさん [sage] 2009/09/15(火) 20:34:27 ID:SZhUZO6T Be:
    >>392
    >素足で靴の中に潜んでたG
    素足じゃなくて靴とか履いているGがいるのか?とちょっと悩んだ
    もしいたら、Gの中の人はイスの大いなる種族だろうけど 

402 イラストに騙された名無しさん [sage] 2009/09/15(火) 23:48:59 ID:p4gdi56D Be:
    うどん屋の知人の話なんだが
    店内にネズミが出現したので客に気付かれないように対処しようとしたら
    先にお子様に捕捉されて「あ、ピカチューだ!!」って叫ばれて大変な事になったとか 

408 イラストに騙された名無しさん [sage] 2009/09/16(水) 06:09:21 ID:yFMz8k4x Be:
    ここはなんのスレだw 

412 イラストに騙された名無しさん [sage] 2009/09/16(水) 07:23:41 ID:8ZK7JCRJ Be:
    >>408
    なんか這いよるもの総合スレとなってるなw 

434 イラストに騙された名無しさん [sage] 2009/09/16(水) 23:50:17 ID:cb62Ki99 Be:
    ニャル子さんがネタとしてパロられる日が来るとは…… 

435 イラストに騙された名無しさん [sage] 2009/09/17(木) 00:39:22 ID:YovSx/sl Be:
    >>379
    「にゃ……にゃるらとてっぷ?」
    「そうです! いつもニコニコあのたの隣に這い寄る混沌!」

    まさか本当にやってるとは思わなかった 

436 イラストに騙された名無しさん [sage] 2009/09/17(木) 00:42:05 ID:y4YLxdzD Be:
    >>435
    SANチェックに失敗した……

    文字が、文字が! 

■_ なんだなんだ

sumim さんチェックのあとででも読んでみようかしらん(笑)


[Help-smalltalk] "Computer Programming using GNU Smalltalk" is out!

From: 	Canol Gokel
Subject: [Help-smalltalk] "Computer Programming using GNU Smalltalk" is out!
Date: 	Sun, 4 Oct 2009 17:51:55 +0000 (UTC)
User-agent: 	Loom/3.14 (http://gmane.org/)

Finally, the book I'm working on for a while is finished. I know that this book
won't add any knowledge to most of the members of this mailing list, since it is
aiming absolute beginners, but if you see someone around willing to learn what
programming and GNU Smalltalk/Smalltalk is about then feel free to recommend the
book.

You can grab your copy from:

http://www.canol.info/books/computer_programming_using_gnu_smalltalk/computer_programming_using_gnu_smalltalk.zip

it is aiming absolute beginners とな。

■_ ありがとうございます

丁稚な日々 VC9 with msvcrt.dll
http://www.garbagecollect.jp/~usa/d/200910a.html#id20091005_P1

問題なんて特になくて(ぉ、VC9で使える、msvcrt.dll用のヘッダとインポートライブラリをい
かに入手するかだけですね。で、WDKにそれがあった、と。

単にそれだけ。それを見つけることさえできていれば誰でも同じことができたはず。

いやまあ、rubyのソースコード中にはVCのバージョンによって処理を変えているところがあるわ
けですが、実際にはコンパイラのバージョンによって変えるべきところとランタイムのバージョ
ンによって変えるべきところがあるので、その辺を整理する必要はありました。

数年前になりますがわたしもちょっとだけやってみたのですけど、 ちょっと苦戦しそうな気配がしたのでとっとと投げてしまっていたのでした。

■_ 本日の巡回から

2009年10月04日

■_

・あぶさん引退
10/5発売号掲載分でついに引退とか(予告はシーズン初めにあったとか)。 んで、松坂の外れ一位でベイスターズに指名されるもいろいろあって現バファローズの 古木が戦力外通告を受けたとか。2003年あたりのあぶさんにも登場したのにねえ。 まあ、なんというか。

時間がびみょーにないというか、いろいろやる気がねーとか。

■_


推薦図書/必読書のためのスレッド 52 
43 デフォルトの名無しさん [] 2009/10/04(日) 05:33:04 ID: Be:
    買おうと思いながら忘却してた本が、いつの間にか絶版になってて困ることがたまにあるんですが、
    絶版情報を事前に入手するにはどうしたらいいんでしょうか?
    その場で買うのがいいんでしょうけど、おいそれと2千円出せるほど裕福じゃないです。
    (だからって絶版になるとヤフオクで高額取引になる可能性がある・・・) 

44 デフォルトの名無しさん [sage] 2009/10/04(日) 06:22:21 ID: Be:
    一般的な方法はないです。
    事前に買っておけない人は、図書館で読めばいいんじゃないの? 

45 デフォルトの名無しさん [sage] 2009/10/04(日) 06:58:27 ID: Be:
    図書館池 

46 デフォルトの名無しさん [sage] 2009/10/04(日) 12:25:47 ID: Be:
    そもそも技術書が簡単に増刷するわけないだろ。
    いずれ必要になるなら先行投資すべし 

47 デフォルトの名無しさん [sage] 2009/10/04(日) 14:10:42 ID: Be:
    事前って言うか、最初にAmazonが無くなることが多いからとりあえず気になる本はリストに入れるなりして一ヶ月に一回くらいチェック
    在庫が無くなったら他のところで買う。 

48 デフォルトの名無しさん [] 2009/10/04(日) 14:19:32 ID: Be:
    今必要の無い本は、9割9分将来も必要ないから、今買う必要は全く無いよ。
    稀に必要になったとしても、その時にはより良い本が出ている可能性もあるから、尚更、今買う必要は無い。

    要不要ではなく、単に物欲で欲しいのなら、さっさと買って宝物箱に大事にしまっておけ。 

49 デフォルトの名無しさん [sage] 2009/10/04(日) 15:06:11 ID: Be:
    宝物箱買ってきます 

50 デフォルトの名無しさん [] 2009/10/04(日) 16:05:30 ID: Be:
    >>47それは新しい版が出る前兆である事も多いから

まああらかじめわかれば苦労はしないわな。 ある程度の予測はできるけど。

くだすれFORTRAN(超初心者用)その4 
618 デフォルトの名無しさん [sage] 2009/09/26(土) 02:36:35 ID: Be:
    処理系:gfortran v4.2
    したいこと:モジュールに関数オブジェクトを保持させたい。
    例えば、モジュールに変数3をセットし後に取得するプログラム
    module Test
       implicit none
       integer,private::a
    contains
       subroutine set(x)
         integer,intent(in)::x
         a = x
       end subroutine
       integer function get()
         integer::get
         get = a
       end function
    end module
    program main
       use Test
       implicit none
       call set(3)
       print *,get()
    end program
    というものを書くことが出来ます。

    同じように、モジュールに関数を保持させることは可能でしょうか?

619 デフォルトの名無しさん [sage] 2009/09/26(土) 02:43:36 ID: Be:
    オイラー法のプログラムを書こうと思っているのですが、関数渡しで
    subroutine proceed(f,x,y,step)
      interface
       double precision function f(x)
         double precision::x
       end function
      end interface
      ...
    end subroutine
    と引用仕様記述を書くのではなく、例えばtarget_functionという変数名
    に保持してしまって、後は
    target_function(x)
    というのを呼び出すだけ、みたいなのにしたいのです。 

620 デフォルトの名無しさん [sage] 2009/09/26(土) 19:24:10 ID: Be:
    >>618
    integer, private, SAVE :: a

    にすればおk?
    save無くても大概大丈夫だと思うが。

621 デフォルトの名無しさん [sage] 2009/09/26(土) 19:50:23 ID: Be:
    >>620
    値じゃなくて、できれば関数保持する方法が。
    >>618は何したいのかわかりやすくする為の例だったんですけど、
    我ながら読むと分かりにくい。

    似たような感じで、関数を保持させたいんです。 

622 デフォルトの名無しさん [sage] 2009/09/26(土) 22:21:48 ID: Be:
    >>621
    PROCEDURE POINTER で駄目かな?
    インターフェースは要るが。

    MODULE m_unko
    IMPLICIT NONE
    INTERFACE
    REAL FUNCTION f1(x)
    REAL, INTENT(IN) :: x
    END FUNCTION f1
    END INTERFACE

    PROCEDURE(f1), POINTER :: unko
    REAL, PARAMETER :: pi = 4.0 * ATAN(1.0)

    END MODULE m_unko
    !
    PROGRAM omeko
    USE m_unko
    IMPLICIT NONE
    unko => SIN
    PRINT *, unko(pi)
    unko => COS
    PRINT *, unko(pi)

    STOP
    END PROGRAM omeko 

623 デフォルトの名無しさん [sage] 2009/09/26(土) 22:59:45 ID: Be:
    横からですいませんが、PROCEDUREって何ですか?
    90以降の機能ですかね? 

624 デフォルトの名無しさん [sage] 2009/09/26(土) 23:51:06 ID: Be:
    >>623
    Fortran2003 の機能です。

    副プログラムのインターフェースを、一括化できたりします。
    インターフェースを書く代わりに、 Procedure (sub0) :: sub1, sub2 など。
    type っぽいかんじで。

625 デフォルトの名無しさん [sage] 2009/09/27(日) 00:28:40 ID: Be:
    >>624
    なるほど。ありがとうございます! 

626 デフォルトの名無しさん [sage] 2009/09/27(日) 05:28:41 ID: Be:
    >>622
    ありがとうございます。
    でも、gfortranの4.2じゃできないっぽいですね。
    v4.3以降でサポートなので、v4.3入れてやってみます! 

627 デフォルトの名無しさん [] 2009/09/27(日) 07:50:23 ID: Be:
    お礼はいりませんよ。 

628 デフォルトの名無しさん [sage] 2009/09/28(月) 07:04:01 ID: Be:
    program orei
    implicit none
    do while (.true.)
     write(*,*) '627 ありがとう'
    end do
    end program orei 

629 デフォルトの名無しさん [sage] 2009/10/03(土) 17:46:13 ID: Be:
    Fortranの名著的な入門書ってありますか?

630 デフォルトの名無しさん [sage] 2009/10/03(土) 17:56:00 ID: Be:
    森口繁一のFORTRAN入門? 

631 デフォルトの名無しさん [sage] 2009/10/03(土) 18:18:32 ID: Be:
    それって77じゃない?
    あえて理由がない限りは、77はすっとばして90の勉強をしたほうがいいと思うけど 

632 デフォルトの名無しさん [] 2009/10/03(土) 18:18:59 ID: Be:
    浦昭二編のFORTRAN77入門改訂版だろう
    やっぱ

    プログラミングの入門者には迷著かもしれないが 

633 デフォルトの名無しさん [sage] 2009/10/03(土) 19:00:12 ID: Be:
    >>631
    そうは言うがな、大佐。
    F90以降は入門書どころか日本語の書籍自体少ないし・・・ 

634 デフォルトの名無しさん [sage] 2009/10/03(土) 19:35:16 ID: Be:
    倍精度の説明をキッチリやってる本ってあったっけ?見た
    記憶無いんだが。

    90 といえば bit の別冊であったけど、あれも絶版だよね。
    単行本にしたらいいのに。あとソフトバンクからも90の本
    は大昔に出てたそうだな。どっちも持ってないけど。 

635 デフォルトの名無しさん [sage] 2009/10/04(日) 02:12:27 ID: Be:
    >>634
    Bit別冊はMetcalf&ReidのFortran90 Explainedの訳本だから、まぁ今は最新版の原著を買えばいい?
    入門書とはいえない気もするが。

636 デフォルトの名無しさん [sage] 2009/10/04(日) 19:45:15 ID: Be:
    C++は数年使ってるんだが大学で初めてFortran使わされることになった
    templateとかクラスがなくて心細いよ 

637 デフォルトの名無しさん [sage] 2009/10/04(日) 20:23:56 ID: Be:
    まだFortranを使わせる所もあるんだ。
    物理系? 

638 デフォルトの名無しさん [sage] 2009/10/04(日) 20:38:02 ID: Be:
    うん物理 

639 デフォルトの名無しさん [sage] 2009/10/04(日) 21:56:45 ID: Be:
    分野にもよるけど地球物理系もFortranがバリバリ現役
    しかもFortran77
    過去の資産有りすぎ
    Fortranのサブルーチンは変数が参照渡しだから
    他の言語に移植するときめんどい 

640 デフォルトの名無しさん [sage] 2009/10/04(日) 23:59:49 ID: Be:
    77はダイレクトに変数とかに触っている気がして気持ちいい。
    90/95とかだと膜ごしに触っているような感触と言うか。
    でもINTENTとかをガチガチに書いた90の方が全般的には気持ちいいが。
    2003は実行時の多態化とか入れて便利そうなのは分かるが、また実行時バグが増えそうで
    微妙な感じがする。

641 デフォルトの名無しさん [sage] 2009/10/05(月) 00:07:32 ID: Be:
    >>640
    >INTENTとかをガチガチ

    計算用の言語としては、この辺で十分な気がする。
    十分具体的で十分美しい。かつ十分便利。

    もう95位で仕様凍結してくんないかな・・・

Fortran 90 だか95だかの入門書っつっといて、中身を見るとほとんど 77 てがありましてですね。 著者は(ぴー)

2003 で 、PROCEDURE とかなんとか。知らなかった。

■_ Perl 6

省略表記の類。だろうか?


Journal of masak (6289)
Sunday October 04, 2009
06:47 AM

The dot is the cutest sigil
[ #39709 ]

I've recently gotten into this style of programming:

given %some-hash {
    if .<foo> {
        .<bar> = .<baz> + .<austria>;
    }
}

I keep thinking of it as a wonky kind of sigil, the .<> sigil, which has its 
very own variable namespace inside of the hash I've chosen as topic.

Now let's say that the above piece of code was part of a prototyped program which 
later evolved to use objects instead of sloppy hashes. Then the same code becomes even 
nicer:

given $some-object {
    if .foo {
        .bar = .baz + .austria;
    }
}

The advantages of objects to hashes are immediate (and well-known):

    * Less to write.

    * The translation between the old style and the new is automatic. Just remove the pointy elbows.

    * Spelling errors are now caught at runtime, as opposed to never.

    * The reason assignments (like the assignment to .bar above) work is that attribute
      accessors can be made rw. The flip side of that is that one can omit the rw and
      avoid assignment accidents. That's also an improvement over the hash.

    * Now the dot really looks like a cute little sigil. It isn't, of course, it's still
      the call-public-method twigil we know and love. But it's even easier to pretend 
      that the attributes are special variables namespaced under the chosen object.

All this is fairly trivial; I just think it's a nice syntax. But it is with this 
example that the truth finally sinks in: keeping $_ and self separate from each other 
in Perl 6 was a really good idea.

With the syntax Perl 6 settled on, it's like there are two topics in a method: the 
common one ($_), and the OO one (self). And each has wonderful shortcuts: with $_ you 
just use prefix:<.> as above, and with self, you can use $. or @. or %. ad lib. 
The OO form is slightly longer than the common form, since OO is more intricate (and 
less ubiquitous).

Long form     Short forms
=========     ===========
$_.foo        .foo

self.foo      $.foo
              @.foo
              %.foo

And since they're disjunct from each other, you never have to context-switch or worry 
about what it is you're looking at when you see .foo. Unless you explicitly mix the 
two together with given self or invocant $_ which you're entirely free to do, but 
remember that it only buys you one character.

As an added bonus, we can now re-write the code example in the rejected rfc 342 so 
that it works in today's Perl 6, without introducing extra syntax:

my $record = loadrecord($studentID);
given $record {
    my $spam = open .minimum;
    $spam.say: qq:to'SPAM';
    Dear {.name}:
            Your tuition is now due.  Please send in a payment
    of at least {.minimum}.
    SPAM
};


self.foo → $.foo/@.$foo/%.foo ってのは self の sigil を省略してんのかな。

■_ 本日の巡回から

2009年10月03日

■_

・アキバに行くペースがめっきり落ちたなあ。

・RegionalRubyKaigi
Tokyu.rb でもやるんですかっ。

・うひ
Masterminds of Programming - O'Reilly Media をパラパラと斜め読みしてたのですが、Objective-C の作者のところで

Objective-C and C++ both started from C, but they went in two very different directions.
Which approach do you prefer now?

Tom: There's the successful direction, and then there's the approach that Bjarne took 
with C++. In one case, it was a small, simple -- dare I say, elegant -- programming 
language that was very crisp and well defined.  In the other case it was a pretty ugly, 
complicated, difficult language that had some really troublesome features. I think 
those are the distinctions between the two.

Is C++ too complex in some ways?

Tom: Oh, absolutely.

It's still evolving. They are still adding things today.

Tom: Well, and go to it. I happen to like my languages really simple. APL is nice 
programming language because it's incredibly simple but outrageously poweful for doing 
certain kind of application. If I'm writing a statistical package, then APL is a dandy 
language to be using because it really does matrix algebra better than anything I know 
of. But, you know, it's just an example.

Why do you think that C++ was used more freqently than Objective-C?

Tom: It had the AT&T moniker behind it.

Just that?

Tom: I think so.

What do you think about Objective-C today?

Tom: It still exists. How about that?

というやり取りが。これは日本語版出さないのかなあ。 そしてオライリーのサイトでこういうのを発見 Data Mashups in R - O'Reilly Media おお、R本(入門書の類ではないみたいだけど)。

■_ 竜虎相撃つ

昨日ちょっと書いたタイガーブック(Modern Compiler Implementaion in ML/C/Java)ですが、 原書で新刊が出るのではなく、邦訳が出るという話だったようです(ML版のみ?)



「コンパイラ・スクリプトエンジン」相談室13 [chaika]
528 デフォルトの名無しさん [sage] 2009/10/01(木) 23:19:37 ID: Be:
    タイガーブックの最新版ってどうよ?
    今月末に出るけど 

529 デフォルトの名無しさん [sage] 2009/10/02(金) 20:43:42 ID: Be:
    どうよ?だと?
    自分で買ってきて報告しろやヴぉけ 

533 デフォルトの名無しさん [sage] 2009/10/03(土) 05:55:58 ID: Be:
    タイガーブックがついに邦訳されて今月末に出版されるよ 

534 デフォルトの名無しさん [sage] 2009/10/03(土) 07:23:00 ID: Be:
    無駄無駄
    されるよ?厨はいつだって人から貰うだけ 

読み返しても、528 の書き方じゃあ邦訳版の話をしてるとはとれねえよ○| ̄|_



【予約】MLによる最新コンパイラ構成技法 [本] セブンアンドワイ ヤフー店 - Yahoo!ショッピング
【予約】MLによる最新コンパイラ構成技法 [本]

JANコード:9784798114682

販売価格:6,090円(税込)

出版社名:翔泳社 発売予定日:2009年10月29日

本書は不朽の名著『コンパイラ-原理・技法・ツール」(ドラゴンブック)に並び称される名著、
別名「タイガーブック」とも呼ばれる『Modern Compile Implementa
tion inML』の翻訳本です。ML(メタランゲージ)を教材に、オブジェクト指向型言
語や関数型言語といった最新の言語のコンパイラをどのように構築・実装するかを懇切丁寧に解
説し、またガベージコレクションやコンパイラの最適化など他に類を見ない充実した内容です。
研究者・専攻学生・エンジニアにとって待望の1冊。 

Amazon さんにもあった。



Amazon.co.jp: 最新コンパイラ構成技法: Andrew W. Appel, 滝本 宗宏, 神林 靖: 本
内容紹介

あの“名著”堂々の翻訳刊行!

本書は、プリンストン大学のコンパイラ講座の授業内容に沿ったコンパイラ構成法の教科書であ
りながら、不朽の名著『コンパイラ 原理・技法・ツール』(ドラゴンブック)に並び称される、
別名「タイガーブック」とも呼ばれる“Modern Compile Implementation in ML”の翻訳です。

ML(メタランゲージ)という理論的背景の非常にしっかりした言語を教材に、オブジェクト指向型
言語や関数型言語といった最新の言語のコンパイラをどのように構築・実装するかを懇切丁寧に
解説してある本筋に加え、ガベージコレクションやコンパイラの最適化など、他に類を見ない充
実した内容を誇り、研究者・専攻学生はもとより、ソフトウェア開発現場のメインストリームに
いるエンジニアにも待望の一冊となることでしょう。

登録情報

    * 大型本: 520ページ
    * 出版社: 翔泳社 (2009/10/30)
    * 言語 日本語
    * ISBN-10: 4798114685
    * ISBN-13: 978-4798114682
    * 発売日: 2009/10/30

しかし ML…。これでML勉強会ブームが起き…たりはしないよなあ(笑) OCmal とか F# あたりでやってみる人がでたりして。

■_ 重要だといわれましても

5.11.0 って(11で奇数だから)開発バージョンだしなんで重要なんだろうと思いつつ。



Why Perl 5.11.0 Matters - Modern Perl Books, a Modern Perl Blog
Why Perl 5.11.0 Matters

Jesse Vincent announced the Perl 5.11.0 release.

Perl 5.11.0 is the first release in the development track of Perl 5. Perl 5.11.x will 
become Perl 5.12.0 at some point in the future. 5.11.0 represents years of development 
-- patches, branches, backports, changes, bugfixes, cleanups, rephrasings, and lots of 
work behind the scenes to improve the Perl 5 language.

The most important part of the release announcement is the schedule for subsequent 
releases in the Perl 5.11.x family: a new development release every month on the 20th. 
Jesse's announcement explains that the intent of the new development model is to avoid 
burning out the brilliant, dedicated, and valuable people who've been pumpkings before. 
That's important.

月例リリース?

There are other valuable results of this change, though. The most important is that 
Perl 5.11.x reduces risks associated with developing and releasing Perl 5.12.0:

5.12のリリース時の問題を減らそうと。

    * The release process itself has changed (and will continue to change) to make 
      monthly releases possible. The release process won't scale if it takes a week's
      worth of effort on the part of any individual. Yet monthly development releases
      are much less risky than supported releases; a bit of confusion or a delay is
      less dramatic.

月例リリースを可能とするためにリリースプロセスを変更(さらなる変更も)。

    * The development process will (likely) fall into a cadence around the monthly 
      releases. Even though development releases can have less polish than a supported 
      release, no one wants to release an uninstallable tarball which fails important
      tests. This provides a pressure to keep the trunk stable and to merge destabilizing
      changes just after a release.

    * Multiple potential release managers remove the bottleneck on one individual, 
      require a well-understood, documented, and automated release process, and allow
      anyone trustworthy to step in at the last moment.

リリースマネジャーを複数?

    * Writing release notes which represent a month's worth of work is easier than 
      writing release notes (and changelogs and...) that represent a year's worth of
      work. The release notes and deltas for Perl 5.12 should be a concatenation of
      the release notes and deltas for all releases in the Perl 5.11.x family.

リリースノートはこまめに書いていったほうが後々楽よと。
一年毎のリリースでリリースノートを書くよりも、一月ごとでやったほうが楽。

    * Regular releases improve the testability of software by providing a convenient 
      point for mutual debugging. Bisecting a month's worth of changes to find a bug is 
      easier than bisecting a year's worth of changes to find a bug.

定期的なリリースを行うことで、testablitiy (テストのしやすさ?)を向上させる。
年毎のリリースでバグを追いかけるより、月ごとでやったほうが追いかけやすい。

    * Experimental features can reach a wider audience of testers and developers 
      without p5p committing to supporting those features as-is (or at all) in stable 
      releases. Faster feedback is always useful.

実験的な機能をより広い audience に試してもらえるようになる。
フィードバックがよりすばやく得られるようになり、それは有用。

I suspect -- but cannot prove yet -- that regular releases will improve the velocity 
of Perl 5 development as well as improving the long-term planning of Perl 5. That'll 
be easier to measure by early 2010.

Congratulations to Jesse and all of the other Perl 5 committers.

■_ ループ

確かに、while {} でも do {} while でも書きづらいパターンてあるんだよな。 自分は、そういう場合は C なら

  for (;;) {
       処理1
       条件判定
       処理2
  }

のようにするのが多いかな(もちろん、while()なりfor()の条件部分に押し込められる 場合もあるけど)。

"Loop-and-a-half processing": is this good style? : programming

"Loop-and-a-half processing": is this good style? (self.programming)

I'm in a Matlab class in college, but I've done a fairly good amount of programming 
self-education. We're talking about while loops, and the book talks about 
'loop-and-a-half' processing where we 'enter the loop and perform some computation 
before realizing we do not need to continue. The example they give is as follows:

R = 1;
while R > 0
    R = input("Enter a radius: ");
    if R > 0
        area = pi * R ^ 2;
        circum = 2 * pi * R;
        fprintf('area = %f; circum = %f\n', area, circum);
    end
end

While I understand the point and see why this situation works, it seems inefficient: 
every iteration you check the value twice.

Wouldn't this be better?:

R = 1;
R = input("Enter a radius: ");
while R > 0
    area = pi * R ^ 2;
    circum = 2 * pi * R;
    fprintf('area = %f; circum = %f\n', area, circum);
    R = input("Enter a radius: ");
end


No one seems to have made clear that in the original code user input of 0 or less 
halts execution, otherwise it keeps asking for input and giving results - why this is 
desired behaviour is beyond the scope of what was explained.

 

I'm not sure why they'd really want to loop it, but clearly a radius of less than zero 
is outside the domain, and a zero radius is kind of useless.


Which is kind of my point - there is a blurring between the error checking for the 
calculation and the main loop termination condition.

I guess what I am trying to say is often you need to focus on the requirement 
specification to get the semantic reasoning behind a syntactic choice.


computing hardware increases in speed faster than your software will be updated. 
you're supposed to code to optimize ease of maintenance, not number of comparisons. 
this becomes much, much, much more apparent as you get into longer and more 
complicated programs.


The first one doesn't repeat if the value is 0 or less. If the if statement condition 
is false, the next iteration's while condition is definitely false as well


interesting. thought i deleted that comment after i (finally) noticed the other input 
statement, and that the first program does not do what i thought it did either. lol.

You're worried about efficiency in a loop that blocks on human input? I would say that 
duplicating input("Enter a radius: ") is even worse than the first crap 
example.

This isn't Matlab, but the correct thing would be:

while True:
  R = input("Enter a radius: ")
  if R <= 0:
    break
  do_stuff


    You're worried about efficiency in a loop that blocks on human input?

You appear to be labouring under the misapprehension that optimisation is for speeding 
things up, as opposed to bragging. You're never going to get to hang with the cool 
kids.

why not... (assuming your language understands 0 as false and everything else as true, 
if not change to ((R =input(...)) > 0), i've never used Matlab)

while R = input("Enter a radius: ")
    area = pi * R ^ 2;
    circum = 2 * pi * R;
    fprintf('area = %f; circum = %f\n', area, circum);
end


The second form is the classic structured programming pattern "Advanced Reading".


I learned to call it "priming read". But yeah, it's a language-independent 
idiom that should be well understood by anyone reading your code.

The first version, while it avoids having to call "read" twice, is actually 
more complex both for a human reader and for the CPUs pipeline (for roughly the same 
reason).

You could do

while true
    R = input("Enter a radius: ");
    if R > 0
        area = pi * R ^ 2;
        circum = 2 * pi * R;
        fprintf('area = %f; circum = %f\n', area, circum);
    else
        break;
    end
end

(Sorry if my syntax is wrong, not my usual language.)

Edit: Oops, just read other posts with the same answer. Great minds work alike!


If I had to choose between the two, I'd go with the first one, because the input is 
the more complex operation. While in this simple example it's a one-liner, processing 
user input is generally more complex.

Even in this simple instance, if for example you needed to change the language of the 
prompt, you would need to change it twice. This is not a good habit to get in to.

In a different language this would be an ideal case for a do...while loop, which I 
believe Matlab doesn't support.

If you want to eliminate the value check on every iteration, and avoid duplicating the 
input statement, I'd suggest this:

while true
    R = input("Enter a radius: ");
    if R == 0
        break
    end
    area = pi * R ^ 2;
    circum = 2 * pi * R;
    fprintf('area = %f; circum = %f\n', area, circum);
end


do...while does not solve this problem -- it ends up looking just like his first example.

do
  read
  if read was successful
    process data
while read was successful

[edit: formatting]


Oops, you're right. I was thinking of something like segoe's solution, but my brain 
got cross-wired. Must be getting old.

I'm not sure if matlab supports the syntax, but I would tend to write the expression as:

while (0 < (R = input("Enter a radius (0 to quit): ")))
    printf(" Area: %f\nCircumf: %f\n", (pi * R^2), (2*pi*R));

This seems more readable to me because the loop condition matches what you want to do 
(you want to loop while you have a positive radius), and having the values calculated 
in the print statement doesn't obfuscate the program much in this case and saves a 
substantial amount of vertical screen realestate.


Knuth actually said "premature optimization is the root of all evil."

Anyway, this question isn't really about optimization, since it's simple enough for 
modern optimizers to automatically sort out the extra integer comparison. I'd say that 
it's more about the DRY principle.

He used the word "inefficient", but it's really a style question.


Yeah, as I said, I'm not much of a programmer. I've done some self study, but the most 
complex thing I've ever written was an ASCII checkers game (with no AI of course). I'm 
definitely not to the point of serious optimization.

■_ ヲチ

マ板編。

■自宅待機プログラマが自宅から集うスレ 3ヶ月目■
268 仕様書無しさん [] 2009/09/19(土) 00:16:31 ID: Be:
    うどん屋の経験があってもラーメン屋の案件が取れない。
    かつ、とんこつらーめん実績では、
    しょうゆラーメン屋の案件が取れない。

    で、年齢制限まである。
    いまのIT業界はそんな感じ。 

269 仕様書無しさん [sage] 2009/09/19(土) 00:30:15 ID: Be:
    そうなんだよなぁ。。。

    年齢制限なんとかならんのか。

270 仕様書無しさん [] 2009/09/19(土) 00:52:58 ID: Be:
    新人はだめ、年寄りはだめって言っちゃうと、
    業界は縮退していっちゃうよね。 

271 仕様書無しさん [sage] 2009/09/19(土) 01:25:23 ID: Be:
    プログラマーならどんなに安くても年収600は硬いだろ?
    お前らただのアルファベット打ちじゃないの? 

272 仕様書無しさん [sage] 2009/09/19(土) 02:34:07 ID: Be:
    六百ももらってるやつはすでにプログラマじゃないだろ 

うまい表現だなあ。>ラーメン屋

【まるで】使えない新人 0x1C 
156 仕様書無しさん [sage] 2009/09/30(水) 20:09:42 ID: Be:
    話題も尽きたようだし、俺様がとっておきの話をしてあげやう。

    ある日、隣のチームに謎の新人(ただし28歳男)が入ってきた。
    で、隣のチームはその彼に早速一つ仕事をお願いしたらしい。
    「テストに使いたいので、このCDをちょっとリッピングしておいて」
    「はい、分かりました!」

    2時間後、困った顔をした彼は、こう聞いてきたそうな。
    「すみません、一生懸命探したんですけど、リピームっていう言葉が見つかりませんでした!」

    その場にいる全員でずっこけた。
    その日から彼のニックネームはリピーム。 

157 仕様書無しさん [sage] 2009/09/30(水) 20:29:00 ID: Be:
    >>156
    なんというアホの子・・・
    探したってのはCDを聞いて探したって事なんだろうか。

158 仕様書無しさん [sage] 2009/09/30(水) 20:40:00 ID: Be:
    リッピングって何? 

159 仕様書無しさん [sage] 2009/09/30(水) 20:40:30 ID: Be:
    ぐぐれかす 

160 仕様書無しさん [sage] 2009/09/30(水) 21:34:11 ID: Be:
    違法コピーのことだろ 

161 仕様書無しさん [sage] 2009/09/30(水) 21:45:31 ID: Be:

     は ぁ ?

162 156 [sage] 2009/09/30(水) 22:32:11 ID: Be:
    彼はリッピングという言葉を知らなかったみたいだ。
    だったらその場で聞いても良さそうなものなんだがな・・・

    まあこれがリピーム伝説の幕開けだったのは言うまでもない。 

163 仕様書無しさん [sage] 2009/10/01(木) 00:49:53 ID: Be:
    28とはいえ新人を2時間も放置するなんて可哀想だろ
    1時間過ぎたあたりで怒鳴ってやらないと

    って隣のチームの話か 

164 仕様書無しさん [] 2009/10/01(木) 07:37:15 ID: Be:
    いろんな用語あって解りづらいよな 

165 仕様書無しさん [sage] 2009/10/01(木) 09:36:34 ID: Be:
    >>158
    ようリピーム 

166 仕様書無しさん [sage] 2009/10/01(木) 22:09:23 ID: Be:
    俺もよく分からんぞ。

    リッピングってどの範囲を指す意図だったの?
    wavを取り出すまで?
    isoイメージを作る?
    CDの複製を作る? 

167 仕様書無しさん [sage] 2009/10/01(木) 22:22:00 ID: Be:
    まず辞書ひけ 

168 仕様書無しさん [sage] 2009/10/01(木) 22:37:48 ID: Be:
    辞書をひいたところで、明確なアウトプットが分かるわけがない。
    ゼロサプレスみたいに、ローカルルールで全然違う意味になっている事も
    あるんだし。

    だから、大雑把な指示はきちんと確認しろよ、って話だろ。 

169 仕様書無しさん [sage] 2009/10/01(木) 22:41:03 ID: Be:
    「まず」辞書をひけ 

170 仕様書無しさん [sage] 2009/10/02(金) 00:32:28 ID: Be:
    CDのデータPCのココに吸い出しといてーとかね
    伝わりやすい言い方はいくらでもある 

178 仕様書無しさん [sage] 2009/10/02(金) 06:22:55 ID: Be:
    リッピングみたいな知ったかワードを使う時点で
    先輩社員も使えない部類。 

183 仕様書無しさん [sage] 2009/10/02(金) 22:55:29 ID: Be:
    どんな職種にも云える事だけどさ
    今の日本人って和訳、つまり漢字充てて日本語化するって事が出来なくなってるよな
    漢字制限で好き勝手に漢字充てるのが難しくなったってのもあるんだろうけど 

185 仕様書無しさん [sage] 2009/10/03(土) 00:30:18 ID: Be:
    カタカナ用語使うのがカッコイイんだよ 

186 仕様書無しさん [sage] 2009/10/03(土) 01:36:39 ID: Be:
    真珠
    紅玉
    錦蛇
    瓜哇

    漢字もなかなかいいよ 

■_ 本日の巡回から

2009年10月02日

■_

江藤も引退ですか

要Sliverlight C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals, Chapter 1 of 13 | Going Deep | Channel 9

Rubyの trunk で VC9でもmsvcrt.dll を使うようにできたらしいけど、 どういった問題があって(こっちはまあ想像できなくもない)、 どのように解決したか解説して☆なー。とか書いても 差分をチェックしろとか言われて終わりのような希ガス。

■_ 虎よ虎よ

「コンパイラ・スクリプトエンジン」相談室13
528 デフォルトの名無しさん [sage] 2009/10/01(木) 23:19:37 ID: Be:
    タイガーブックの最新版ってどうよ?
    今月末に出るけど 

529 デフォルトの名無しさん [sage] 2009/10/02(金) 20:43:42 ID: Be:
    どうよ?だと?
    自分で買ってきて報告しろやヴぉけ 

タイガーブックってこのへん → Amazon.com: Andrew W. Appel: Books, Biography, Blog, Audiobooks, Kindle のだよねえ。 それらしいのは見当たらないけど、出版社か著者のページを見ればいいんだろうか。 Andrew Appel's Home Page ケンブリッジ大学出版局

■_ 品薄

アキバのとらあたりでは山になってたらしいんですが

書店員の情報交換スレ41 [chaika]
981 マロン名無しさん [sage] 2009/10/01(木) 19:19:46 ID:??? Be:
    めだかすくねえ 

982 マロン名無しさん [sage] 2009/10/01(木) 19:24:35 ID:??? Be:
    めだか2冊しかねえ 

983 マロン名無しさん [sage] 2009/10/01(木) 19:36:57 ID:??? Be:
    めだかは絶滅危惧種だからな 

986 マロン名無しさん [sage] 2009/10/02(金) 00:37:06 ID:??? Be:
    トリコが遺伝とめだかの減数パネェっす
    何故かAKABOSHIだけは満数入ってきたというのに・・・ 

993 マロン名無しさん [sage] 2009/10/02(金) 12:06:22 ID:??? Be:
    赤星いらんよ
    めだかくれよ 

994 マロン名無しさん [sage] 2009/10/02(金) 12:11:22 ID:??? Be:
    めだか1とかありえん。
    せめて20あればと頼んで1… 

995 マロン名無しさん [sage] 2009/10/02(金) 12:13:24 ID:??? Be:
    うちなんか0だぜ
    どうせ1しか売れないのに 

996 マロン名無しさん [sage] 2009/10/02(金) 12:32:14 ID:??? Be:
    絶滅危惧種のめだかのために大量繁殖(重版)を希望します 

997 マロン名無しさん [sage] 2009/10/02(金) 12:46:41 ID:??? Be:
    めだか、うちも2だったな大量返本を嫌うのはわかるんだが、売る気あるのかと
    それともアンケートがそんなに良くないのかと考えてしまう
    バクマンの読み過ぎかな 

998 マロン名無しさん [sage] 2009/10/02(金) 16:37:31 ID:??? Be:
    俺が買う分すら入荷しないオワタ\(^o^)/ 

書店員の情報交換スレ42 

9 元書店員 [sage] 2009/10/03(土) 00:34:33 ID:??? Be:
    前スレでめだかボックスの発売日だった事を知って
    買いに行ったけど、どこもかしこも全滅だった…。
    3軒回った100坪クラスの中型書店でも入荷数1~2冊って
    足りないどころの話じゃないぞ!
    ここ最近のJCは1巻でも潤沢とまではいかないけど、
    それなりの数が入荷してた筈なのに何があったんだ? 

10 マロン名無しさん [sage] 2009/10/03(土) 01:46:02 ID:??? Be:
    >>9
    うちは昨年、今年のナツコミ入賞店(集英社のコミック特約店みたいなもの)ですが
    配本2ケタ行きませんでした。
    ジャンプコミックスの新人の1巻の場合、希望数の満数とはいかないまでも
    半数から3分の2ぐらいは入ってくるのですが、今回は非常に数が少なかったorz

    ご指摘の通り、ここ最近のジャンプコミックスにしては珍しいです
    うちのチェーン店も軒並み似たり寄ったりな入荷数の為、恐らく初版がかなり絞られたのでは。
    推測ですが、打ち切りが決まった後に発売されたフープメン1巻以下の刷り部数か
    とらメイトメロンに重点的に配本され一般書店に回らなかった可能性が高いです

    ただ、めだかボックスに関しては、事前にご予約いただいたお客様が、通常より多めでした
    入荷数が少ないのもありますが、その入荷分からご予約分も差っ引いた数が店頭に並びますので
    実際店頭に並んでいた数はごくわずか、ほとんどのお店で午前中もしくは夕方の時点で
    完売状態だったと思われます。

    欲しいと思うお客様に商品をお渡しできないのが何より辛いです、本当に申し訳ない 

11 マロン名無しさん [sage] 2009/10/03(土) 02:25:25 ID:??? Be:
    赤星思ってたより売れたなぁ…びっくりした
    めだかは売れなかった時の事考えて減らしたのか?
    べるぜくらい動くもん、もう1つ欲しいな
    保健室と賢い犬はどうなるやら… 

五件回って何とか手に入りますた ○| ̄|_

■_ なんというか

気の毒っちゃあ気の毒なんだけど、なんでそうなったというか。

至急!!24時間自動運転しているEXCELが止まってしまうんですが///助けてください -OKWave

シーケンサから送られてくるデータがあり、
それを24時間モニターするシステムをexcel2007で構築しています。

詳細
・excelとシーケンサは1秒ごとに通信している
・1ブックに7シート(うち5シートがグラフ)
・一日三つのブックを保存します。
・ひとつのファイルが約400KB程あり、
 一日で諸々含め約1.5Mほどになります。
・excel自体には、タイマーで自動起動するマクロが
 (印刷、保存1、保存2、保存フォルダ作成、画面クリア、
  次回タイマー予約)とあります。
・PCスペックは
 core2duo 500GB メモリ2GB


上記のシステムが、起動後約三カ月目で止まりました。
客先に納めているものなので、直接の原因はわかりません。

システム自体に不具合がないと仮定して、一日1.5Mのファイル増加するシステムは、
三か月そこそこでCPUに負担がかかり止まってしまうものなんでしょうか?

三か月動き続けて止まった、ということは、
一日単位では見えない程度の負担が少しづつかかっていて
(つまり、システムの不具合)
クラッシュしてしまった、とういことなんでしょうか?


非常に、抽象的な質問で申し訳ありませんが、
なにかヒントをくだされば、と思います。
お願いします。
そもそも、24時間365日稼動させるシステムを、PCごときにやらせるほうが間違いでしょう。
ましてや、Excel使ってるってことは、windowsなわけですよね?
3ヶ月連続稼動させるってのも酷な話かと思います。

何かしらサーバーを用いてC言語なりJavaなりでシステムを構築して、
必要な時に保存させたExcelを開いてみるってだけの使い方にしたほうが良いかとおもいますよ。
・・・すみません。
プログラムというより、PC自体そこまでの知識がない状態で
急遽、システムを作らなければならない状況でして。。

周りに教えてくれる人がいなかったので、それこそ、本やネットの助けを借りて、
独学でここまで来たようなものです。

そんな状況だったので、三菱(シーケンサが三菱なので)の通信ソフトでexcel使った
作りやすいものがあると、勧められたのが運のツキでしたか。
確かに、そのソフトのせいで色々と縛られています。

逆に、三か月動いたってことは、良くできたほうなんですかね。
サーバーですか。。。
C言語ですか。。。

また。ゼロから勉強しなくてはなりません。

CSV形式への変更を考えてはいたので、
ついでにVBをちゃんと勉強しようとは思っていたのですが。
(excelを使用しないで作りたかった)

なんだか、お先真っ暗になってきました。
眠れそうにありません。。。
「Windows 連続運転 連続稼動」などをキーにしてググってみてください。

いつくかのサイトによると、
Windowsでの一定期間以上の連続運転は、どうも問題が発生しやすいようです。
回避策としては、ひと月毎に再起動する、などとの記事も。

以上です。
・・・そんなものなんですか。Windowsって。。。

知りませんでした。
前の会社では、3,4年つけっぱなしのパソコンがゴロゴロしていたので、
そんなことは気にも留めてませんでした。

確かにそれらは、フリーズすれば、手動で再起動かけれる状況でしたから、
知らないところでしてたのかもしれませんね。

やはり、再起動ですか。。

■_ 本日の巡回から

■_

で。 今週苦労してたバグの話なんですが。

/* Append `length' bytes from `string' to the line `to'. */
static void str_append P_((struct line *, const char *, size_t));
static void
str_append(to, string, length)
  struct line *to;
  const char *string;
  size_t length;
{
  size_t new_length = to->length + length;

  if (to->alloc < new_length)
    resize_line(to, new_length);
  MEMCPY(to->active + to->length, string, length);
  to->length = new_length;

#ifdef HAVE_MBRTOWC
  if (mb_cur_max == 1)
    return;

  while (length)
    {
      int n = MBRLEN (string, length, &to->mbstate);

      /* An invalid sequence is treated like a singlebyte character. */
      if (n == -1 || n == -2)
	{
	  memset (&to->mbstate, 0, sizeof (to->mbstate));
	  n = 1;
	}

      if (n > 0)
	length -= n;
      else
	break;
    }
#endif
}

問題のひとつは、MBRLEN(まあ実態は実質 mbrlenと考えて問題ありません)を呼び出したあとの if で、当初は -1 かどうかしか見ていなかったので、-2 が返ってきていた場合に ぐちゃぐちゃになっていたというのがひとつ。 じゃあ上のコード片にあるように -2 もみてやればいいのかというとそうはいかなくて、

static void do_subst P_((struct subst *));
static void
do_subst(sub)
  struct subst *sub;
{
  size_t start = 0;	/* where to start scan for (next) match in LINE */
  size_t last_end = 0;  /* where did the last successful match end in LINE */
  countT count = 0;	/* number of matches found */
  bool again = true;

(略)

  do
    {
(略)
          /* The match was not replaced.  Copy the text until its
             end; if it was vacuous, skip over one character and
	     add that character to the output.  */
	  if (matched == 0)
	    {
	      if (start < line.length)
	        matched = 1;
	      else
	        break;
	    }
	  str_append(&s_accum, line.active + offset, matched);
        }

      /* Start after the match.  last_end is the real end of the matched
	 substring, excluding characters that were skipped in case the RE
	 matched the empty string.  */
      start = offset + matched;
      last_end = regs.end[0];
    }
  while (again
	 && start <= line.length
	 && match_regex(sub->regx, line.active, line.length, start,
			&regs, sub->max_id + 1));

(略)

大雑把に言うと、このdo while ループで置換対象が見つかるかなどに応じていろいろ やってるのですが、do while の最後にある str_append(&s_accum, line.active + offset, matched); これ、一文字転送しないといけないのですが、 マルチバイト文字のときにもなんのおかまいもなしに match には 0 か 1 かの いずれかにしかなりません。それでもうまくいっちゃったりするの場合があるのは、 マルチバイト文字の泣き別れが起きた状態で match_regex (そしてそこから呼び出す re_search やらなんやら)がうまいことつじつまが合った状態で動いちゃうからなんですね。

ところが鬼車を使っている場合は、どうもマルチバイト文字が妙な状態になっているというのを 認識しているようで、while () で呼び出している match_regex() の結果が、GNU regex の 場合と異なるのでした。

どういうことになっているのかポイントだけ抜き出すと、

マルチバイト文字一文字だけ転送する必要がある状態になる

   ↓
	  if (matched == 0)
	    {
	      if (start < line.length)
	        matched = 1;
	      else
	        break;
	    }
	  str_append(&s_accum, line.active + offset, matched);

の部分を通って、match に 1 がセットされた状態で str_append()を呼び出す

  ↓

str_append(to, string, length) の

  MEMCPY(to->active + to->length, string, length);

で、「1バイトだけ」転送する(ここで泣き別れ発生)。ここで続く

      int n = MBRLEN (string, length, &to->mbstate);

で n は -1 (長さが足りない)になるので、今転送した1バイトと後続のバイトを
それぞれ「1バイト文字として」転送する。

のですが、この後続のバイト列を転送するところで バイトの並びを厳しくチェックしているか何かでエラーの値が GNU regex と 鬼車で 変わってくるということのようです。

でも、わたしが MinGW の gcc使ってコンパイルしたものも、GNU regex 使ってるやつが -2 を 返してたりしたんですよね。元のコードが -2 を無視しているということは、glibc だと 同じ状態でも -2 が返ることはないということだと思われるのですがなんとも。

つーかこれに限らず、マルチバイト文字の後続バイトをシングルバイト文字の並びとみなすって よくやってんだけどお前ら何を考えているのかと。 少なくとも2倍に、mbrなんちゃらの呼び出しが増える羽目になるんですけどね。 んなだから、grep でマルチバイト locale のときに桁違いに遅くなったりするんだ というのは多分まったく違う原因です。

こういう話を Ulrich が納得するように書く自信はまったくありません ○| ̄|_

2009年10月01日

■_

・衣替え
ですな。通勤時に見かける高校生も冬服になってるのが結構多く。

・CERT本
翻訳版を見つけたけど、ちと体裁がびみょ。 全訳じゃないのがなあ(といって抄訳かというとそれもちょっと違うような)。 まあ、原書を丸々訳すと厚さもかなりなものになるだろうし、値段も… 原書持ってるし、無理することはないかな。

■_ ひねりも何にもない

テキストデータを圧縮するとかいろいろやりようはあったんでしょうけど。 んで、 src/usr.bin/mg/theo.c - view - 1.111 を元に、Theo 様のありがたーい名言の数々をランダムに表示する fortune(1) なものを作ってみました。

#!/usr/bin/ruby -Ku
# -*- coding: utf-8 -*-

TALK = [
	"Write more code.",
	"Make more commits.",
	"That's because you have been slacking.",
	"slacker!",
	"That's what happens when you're lazy.",
	"idler!",
	"slackass!",
	"lazy bum!",
	"Stop slacking you lazy bum!",
	"slacker slacker lazy bum bum bum slacker!",
	"I could search... but I'm a lazy bum ;)",
	"sshutup sshithead, ssharpsshooting susshi sshplats ssharking assholes.",
	"Lazy bums slacking on your asses.",
	"35 commits an hour? That's pathetic!",
	"Fine software takes time to prepare.  Give a little slack.",
	"I am just stating a fact",
	"you bring new meaning to the terms slackass. I will have to invent a new term.",
	"if they cut you out, muddy their back yards",
	"Make them want to start over, and play nice the next time.",
	"It is clear that this has not been thought through.",
	"avoid using abort().  it is not nice.",
	"That's the most ridiculous thing I've heard in the last two or three minutes!",
	"I'm not just doing this for crowd response. I need to be right.",
	"I'd put a fan on my bomb.. And blinking lights...",
	"I love to fight",
	"No sane people allowed here.  Go home.",
	"you have to stop peeing on your breakfast",
	"feature requests come from idiots",
	"henning and darren / sitting in a tree / t o k i n g / a joint or three",
	"KICK ASS. TIME FOR A JASON LOVE IN!  WE CAN ALL GET LOST IN HIS HAIR!",
	"shame on you for following my rules.",
	"altq's parser sucks dead whale farts through the finest chemistry pipette's",
	"screw this operating system shit, i just want to drive!",
	"Search for fuck.  Anytime you see that word, you have a paragraph to write.",
	"Yes, but the ports people are into S&M.",
	"Buttons are for idiots.",
	"We are not hackers. We are turd polishing craftsmen.",
	"who cares.  style(9) can bite my ass",
	"It'd be one fucking happy planet if it wasn't for what's under this fucking sticker.",
	"I would explain, but I am too drunk.",
	"you slackers don't deserve pictures yet",
	"Vegetarian my ass",
	"Wait a minute, that's a McNally's!",
	"don't they recognize their moral responsibility to entertain me?",
	"#ifdef is for emacs developers.",
	"Many well known people become net-kooks in their later life, because they lose touch with reality.",
	"You're not allowed to have an opinion.",
	"tweep tweep tweep",
	"Quite frankly, SSE's alignment requirement is the most utterly retarded idea since eating your own shit.",
	"Holy verbose prom startup Batman.",
	"Any day now, when we sell out.",
	"optimism in man kind does not belong here",
	"First user who tries to push this button, he pounds into the ground with a rant of death.",
	"we did farts.  now we do sperm.  we are cutting edge.",
	"the default configuration is a mixture of piss, puke, shit, and bloody entrails.",
	"Stop wasting your time reading people's licenses.",
	"doing it with environment variables is OH SO SYSTEM FIVE LIKE OH MY GOD PASS ME THE SPOON",
	"Linux is fucking POO, not just bad, bad REALLY REALLY BAD",
	"penguins are not much more than chickens that swim.",
	"i am a packet sniffing fool, let me wipe my face with my own poo",
	"Whiners.  They scale really well.",
	"in your world, you would have a checklist of 50 fucking workarounds just to make a coffee.",
	"for once, I have nothing to say.",
	"You have no idea how fucked we are",
	"You can call it fart if you want to.",
	"wavelan is a battle field",
	"You are in a maze of gpio pins, all alike, all undocumented, and a few are wired to bombs.",
	"And that is why humppa sucks... cause it has no cause.",
	"cache aliasing is a problem that would have stopped in 1992 if someone had killed about 5 people who worked at Sun.",
	"Don't spread rumours about me being gentle.",
	"If municipal water filtering equipment was built by the gcc developers, the western world would be dead by now.",
	"kettenis supported a new machine in my basement and all I got to do was fix a 1 character typo in his html page commit.",
	"industry told us a lesson: when you're an asshole, they mail you hardware",
	"I was joking, really.  I think I am funny :-)",
	"the kernel is a harsh mistress",
	"Have I ever been subtle? If my approach ever becomes subtle, shoot me.",
	"the acpi stabs you in the back.  the acpi stabs you in the back. you die ...",
	"My cats are more observant than you.",
	"our kernels have no bugs"
]

puts TALK[rand(TALK.length)]

名言を日本語に訳せというのは却下w

■_

blog | Perlgeek.de Blog :: Contexts
NAME

"Perl 5 to 6" Lesson 06 - Contexts

SYNOPSIS

    my @a = <a b c>
    my $x = @a;
    say $x[2];          # c
    say (~2).WHAT       # Str
    say +@a;            # 3
    if @a < 10 { say "short array"; }

DESCRIPTION

When you write something like this

    $x = @a

in Perl 5, $x contains less information than @a - it contains only the number of items 
in @a. To preserve all information, you have to explicitly take a reference: $x = \@a.

のように書いたとき、Perl 5では $x は @a よりも少ない情報しか保持しません。ここで $x が
保持するのは @a の要素数だけです。すべての情報を得るためには、$x = \@ のように明確な形
でリファレンスをとらなければなりません。

In Perl 6 it's the other way round: by default you don't lose anything, the scalar 
just stores the array. This was made possible by introducing a generic item context 
(called "scalar" in Perl 5) and more specialized numeric, integer and string 
contexts. Void and List context remain unchanged.

これは generic item context (Perl 5でスカラーと呼ばれていたものです)を導入することによ
り可能となりました。また、数値コンテキストをより特殊化されて integer コンテキストと文
字列コンテキストとなりました。VoidコンテキストおよびListコンテキストは変更されずに残さ
れています。

You can force contexts with special syntax.

特殊な構文を用いてコンテキストを強制することができます。

    syntax      context
    ~stuff      String 文字列コンテキスト
    ?stuff      Bool   Boolコンテキスト
    +stuff      Numeric  数値コンテキスト
    -stuff      Numeric (also negates) 数値コンテキスト (反転でもある)
    $( stuff )  Generic item context 
    @( stuff )  List Context リストコンテキスト

Slice Context スライスコンテキスト

There's also a new context called slice context. It is a list context in which lists 
don't interpolate.

スライスコンテキストと呼ばれる新しいコンテキストもあります。
これはリストコンテキストですがリストが interpolate されないものです。

     @( <a b> Z <c d> )     # <a c b d>
    @@( <a b> Z <c d> )     # (['a', 'c'], ['b', 'd'])

This was introduced after the observation that many built in list functions had two 
versions - one that returned a flat list, and one that returned a list of lists.

スライスコンテキストはリストを扱う多くの関数が二つのバージョン、一つは平坦なリストを返
すものでもう一つはリストのリストを返すを持っているということがはっきりしたことで導入さ
れました。

You can force slice context with @@( stuff ).

@@( stuff ) と記述することでスライスコンテキストを強制することが可能です。

MOTIVATION

More specific contexts are a way to delay design choices. For example it seems 
premature to decide what a list should return in scalar context - a reference to the 
list would preserve all information, but isn't very useful in numeric comparisons. So 
every possible choice disappoints somebody.

より特定されたコンテキストは設計上の選択を遅らせます。たとえばスカラーコンテキストで返
すべきリストを決定のは早すぎるようですリストの参照がすべての情報を持つことにでしょうが、
それは数値比較の場合には便利なものとはいえません。ですから選択可能な選択肢のどれを選ん
だとしても誰かしらが不満を持つことになるのです。

With more specifc context you don't need to make this choice - it returns some 
sensible default, and all operators that don't like this choice can simply propagate a 
more specific context.

よりコンテキストを特定することによって、この種の選択をする必要がなくなります。
(値を返す側は) sensible なデフォルト値を返し、
すべての演算子がより単純により特定されたコンテキストを伝播させることが可能になります。

For some things like the match object the different contexts really enhance their 
usefulness and beauty.

SEE ALSO

http://perlcabal.org/syn/S02.html#Context

■_ もいっちょ Perl 6



blog | Perlgeek.de Blog :: Custom Operators

Custom Operators

NAME

"Perl 5 to 6" Lesson 13 - Custom Operators

SYNOPSIS

    multi sub postfix:<!>(Int $x) {
        my $factorial = 1;
        $factorial *= $_ for 2..$x;
        return $factorial;
    }
    
    say 5!;                     # 120

DESCRIPTION

Operators are functions with unusual names, and a few addtional properties like 
precedence and associativity. Perl 6 usually follows the pattern term infix term, 
where term can be optionally preceeded by prefix operators and followed by postfix or 
postcircumfix operators.

演算子とは、普通ではない名前を持った関数で、それに加えて優先順位とか結合規則のような幾
つかの属性がついています。通常Perl 6は pettern term として infix term を採用しますが
term はその前に前置演算子 (prefix operators)をつけることや後ろに後置演算子もしくは後置
サーカムフィクス演算子 (pstcircumfix operators)をつけることができます。


    1 + 1               infix (中置)
    +1                  prefix (前置)
    $x++                postfix (後置)
    <a b c>             circumfix
    @a[1]               postcircumfix

Operator names are not limited to "special" characters, they can contain 
anything except whitespaces.

演算子の名前は“特殊なキャラクタ”に限定されることはなく、
空白以外の好きなキャラクタをその名前を構成するものとして使うことが許されます。

The long name of an operator is its type, followed by a colon and a string literal or 
list of the symbol or symbols, for example infix:<+> is the same as infix:'+', and 
it's the operator in 1+2. Another example is postcircumfix:<[ ]>, which is the same 
as postcircumfix:('[', ']').

演算子の長い名前は、その型に続けてコロン、文字列リテラルもしくはシンボル(かsymbols?)
のリストがあるものです。たとえば infix:<+> と infix:'+' は同じ意味であり、
1+2 のような式に使われる演算子です。別の例を挙げると、postcircumfix:<[ ]> は
postcircumfix:('[', ']') と同じ意味です。

With this knowledge you can already define new operators:

この知識があれば、新たに演算子を定義することがもう可能になっています。

    multi sub prefix:<?> (Str $x) {
        2 *  $x;
    }
    say ?4;                         # 8

Precedence 優先順位

In an expression like $a + $b * $c the infix:<*> operator has tighter precedence 
than infix:<+>, which is why the expression is evaluated as $a + ($b * $c).

$a + $b * $c のような式において infix:<*> 演算子はinfix:<+> 演算子よりも強力な
優先順位を持っていますので、この式は$a + ($b * $c) と解釈されることになります。

The precedence of a new operator can be specified in comparison to to existing 
operators:

新しい演算子の優先順位は既に定義済みの演算子との比較によって特定することができます:

    multi sub infix:<foo> is equiv(&infix:<+>) { ...  }
    mutli sub infix:<bar> is tighter(&infix:<+>) { ... }
    mutli sub infix:<baz> is looser(&infix:<+>) { ... }

Associativity 結合規則

Most infix operators take only two arguments. In an expression like 1 / 2 / 4 the 
associativity of the operator decides the order of evaluation. The infix:</> 
operator is left associative, so this expression is parsed as (1 / 2) / 4. for a right 
associative operator like infix:<**> (exponentation) 2 ** 2 ** 4 is parsed as 2 ** 
(2 ** 4).

ほとんどの中置演算子は引数を二つだけ取ります。1 / 2 / 4 のような式があったとき、
演算子の結合規則がその評価をどのように行うかを決定します。infix:</> 演算子は
左結合なので、先の式は (1 / 2) / 4 のように解釈されます。infix:<**> のような
右結合の演算子(べき乗)であれば 2 ** 2 ** 4 は 2 ** (2 ** 4) のように解釈されます。

Perl 6 has more associativities: non forbids chaining of operators of the same 
precedence (for example 2 <=> 3 <=> 4 is forbidden), and infix:<,> has list 
associativity. 1, 2, 3 is translated to infix:<,>(1; 2; 3). Finally there's the 
chain associativity: $a < $b < $c translates to ($a < $b) && ($b 
< $c).

Perl 6ではこの他にも結合規則があります:
同じ優先順位の chaining を禁止しません(2 <=> 3 <=> 4 は許されません)し、
infix:<,> は list associativity を持っています。
1, 2, 3 は infix:<,>(1; 2; 3) に変換されます。
最後の結合規則は chain associativity で、
$a < $b < $c が ($a < $b) && ($b < $c) に変換されます。

    multi sub infix:<foo> is tighter(&infix:<+>)
                          is assoc('left')
                          ($a, $b) {
        ...
    }

Postfcircumfix and Circumfix

Postfcircumfix operators are method calls:
Postfcircumfix 演算子はメソッドコールです:

    class OrderedHash is Hash {
        method postcircumfix:<{ }>(Str $key) {
            ...
        }
    }

If you call that as $object[$stuff], $stuff will be passed as an argument to the 
method, and $object is available as self.

$object[$stuff] として呼び出しを行ったとき、$stuffは引数として method に渡されます。
このとき $object は selfとなります。


Circumfix operators usually imply a different syntax (like in my @list = <a b 
c>;), and are thus implemented as macros:

Circumfix 演算子はたいていの場合は(my @list = <a b c>;のような)
異なる構文を含んでいて、そのためマクロとして実装されます。

    macro circumfix:≪< >≫($text) is parsed / <-[>]>+ / {
        return $text.comb(rx/\S+/);
    }

The is parsed trait is followed by a regex that parses everything between the 
delimiters. If no such rule is given, it is parsed as normal Perl 6 code (which is 
usually not what you want if you introduce a new syntax). Str.comb searches for 
occurences of a regex and returns a list of the text of all matches.

これは デリミタに囲まれたすべてを解析する正規表現が後続する parsed trait です。
もしそのようなルールが与えられていなければ、通常の Perl 6のコードとして扱われます
(新しい構文を使ったのであれば、大抵それはあなたが望んだことではないでしょう)。
Str.comb は occurences of a regex を探し、マッチしたすべてのテキストのリストを
返します。

"Overload" existing operators

Most (if not all) existing operators are multi subs or methods, and can therefore be 
customized for new types. Adding a multi sub is the way of "overloading" 
operators.

既存のほとんどの演算子は multi subs もしくは multi methods なので、
新しい型のためにカスタマイズすることが可能です。multi sub の追加は
演算子のオーバーロード方式を使います。

    class MyStr { ... }
    multi sub infix:<~>(MyStr $this, Str $other) { ... }

This means that you can write objects that behave just like the built in 
"special" objects like Str, Int etc.

これはつまり、StrだとかIntなどのような組み込みの“特殊な”オブジェクト
のように振舞うオブジェクトを記述することができるということです。

MOTIVATION

Allowing the user to declare new operators and "overload" existing ones 
makes user defined types just as powerful and useful as built in types. If the built 
in ones turn out to be insufficient, you can replace them with new ones that better 
fit your situation, without changing anything in the compiler.

ユーザーが新しい演算子を宣言することとオーバーロードをすることを許すことによって
既存の演算子がユーザー定義型をあたかも組み込みの型のように
強力かつ便利なものにします。
仮に組み込みの演算子の効率が良くないのであれば、
あなたの状況によりフィットした新しい演算子でもって置き換えることが
コンパイラには一切変更加えることなく可能です。

It also removes the gap between using a language and modifying the language.

SEE ALSO

http://perlcabal.org/syn/S06.html#Operator_overloading

If you are interested in the technical background, ie how Perl 6 can implement such 
operator changes and other grammar changes, read 
http://perlgeek.de/en/article/mutable-grammar-for-perl-6.

[/perl-5-to-6] Permanent link

1 comments / trackbacks
 
Copyright 2008: Moritz Lenz
This page my be used under the terms of a Creative Commons license.
Layout based on YAML, powered by mowyw and blosxom

■_ バグの話

sed でぶつかったバグの話をまとめようと思ったのだけど、結構面倒なので 週末にでも。


一つ前へ 2009年9月(中旬)
一つ後へ 2009年10月(上旬)

ホームへ


Copyright (C) 2009 KIMURA Koichi (木村浩一)
この文書の無断転載はご遠慮ください(リンクはご自由にどうぞ)。

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