ときどきの雑記帖'

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

一つ前へ 2013年11月(中旬)
一つ後へ 2013年12月(上旬)

ホームへ

2013年11月30日

■_

微分方程式。奥が深い。 ブラック-ショールズ方程式 - Wikipedia 確率微分方程式 - Wikipedia

サイトーさんが酷い人だった (ARISE)

やっと読んだ 泳ぐやる夫シアター やらない夫が南北戦争を戦いぬくようです 第14回 半島戦役 後編

コンピュータって: 機械式計算機からスマホまで
コンピュータって: 機械式計算機からスマホまで 読んだ。 面白かった。 が、「マイクロプロセッサは21世紀最大の発明であり」(p146) ってのは どう考えても20世紀の間違いだと思うんだけどどこから出てきた21世紀。 この本で初めて知った(たぶん)のだけど IBM 1620 - Wikipedia なんてのがあったのね。 ユーザーの間では 1620 を冗談めかして CADET(Can't Add, Doesn't Even Try; 足し算すらできないし試しもしない)と呼ぶ。というのも1620は加算回路を持たず、メモリ上の加算テーブルを参照して加算を実現していたからである[2]。 IBM って色々やってたんだなあ。 ところでこの本書いた人だった。 モダン・コンピューティングの歴史
モダン・コンピューティングの歴史

■_

2013年11月29日

■_

なんか講習会漬けの日。

■_ String types are fine.

先日の string type is broken に対するお返事。 String types are fine. How about your code? : programming String types are fine. How about your code? | Hacker News String types are fine. How about your code? | BufferedConsciousnessStream

■_

エレベーターの話。 鉄道の駅やらで、ちょっと変わったエレベーターが良くあるじゃないですか。 妙に細長くて出入り口が両端についているのとか 床の形が正方形とか長方形じゃなくて斜めになっている辺があるのとか。 あれってその場所に作るためにわざわざああいう形にしたと思うんだけど、 それはどのくらいの手間だったんでしょう。 エレベーターの機構そのものはまあそんなに変わらないとしても、 開発にはそれなりに手間かかりますよね。 あとメンテナンス性なんかはどうなんだろう。

■_

2013年11月28日

■_

エレベーター 建築 動線 扶桑

■_

数学関連で気になった近刊など

■_ Dark Matter Developer

とりあえず備忘録的に。 Dark Matter Developer 記憶にないなー

Mat McLoughlin Dark Matter Developers: The Unseen 99% - Scott Hanselman Mikeのプログラミング・メモ: 「暗黒物質的開発者」とは

The string type is broken | Hacker News The string type is broken : programming

ircmaxell's blog: Beyond Clean Code This is the fourth post in my "Beyond" series. The previous three posts focused on re-imagining OOP and questioning some of the core beliefs that we have come to take for granted. This one is going to be slightly different, in that I want to talk about another angle of writing code: the process itself. We always talk about how code should be clean, but how do you write clean code? シリーズになってるぽい。 ircmaxell's blog: Beyond

■_

連続する数列をハイフンでまとめるピュアシェルスクリプト - ダメ出し Blog

連続する数列をハイフンでまとめるピュアシェルスクリプト - ダメ出し Blog

Twitter の俺の TL にこんなネタが流れてきた。現実逃避にはもってこいのネタ。

    連続する数列をハイフンでまとめるシェルスクリプト - ザリガニが見ていた...。
        http://d.hatena.ne.jp/zariganitosh/20131127/succession_hyphen_number
    Rubyでどう書く?:連続した数列を範囲形式にまとめたい.いや,Rubyで書かない. | 上田さんのブログ
        http://blog.ueda.asia/?p=1663
    awkで連続した数列を範囲形式に - jarp,
        http://jarp.does.notwork.org/diary/201311c.html#201311271
    TL で見かけた回答ツイート
        https://twitter.com/RobustHunter/status/405552789876523008
        https://twitter.com/uspmag/status/405730524733247488
        https://twitter.com/masaru0714/status/405740108948598784

真の shellist たるもの、外部コマンドに頼ってはいけない(適当)。 というわけで、ピュアシェルスクリプトをどうぞ。

awkで連続した数列を範囲形式に - jarp, awk '{a=$1;for(i=0;b=_$++i;a=b)if(a+1==b)$i=-$i;OFS=",";gsub(/,-([0-9]+,-)*/,"-")}

powershell で。と思ったがあまり面白くなかった。 基本 eban さんの焼き直しで %{$h,$f=$_ -split " "; $a=$h; $r=@(foreach ($b in $f){ if (1+$a -eq $b){$v=-$b;$a=$b;$v}else{$v=$b;$a=$b;$v}}) -join ","; @($h,$r) -join ","} | %{$_ -replace ",-(\d+,-)*", "-"} 煮込みが足りませんがいつもの投げっぱなしジャーマンです。はい。

awk にも join あればなあとか思ったのはないしょ。

■_ へみんぐうぇい

If Hemingway wrote JavaScript | Hacker News If Hemingway wrote JavaScript

If Hemingway wrote JavaScript

If Hemingway wrote JavaScript

Aug 3, 2012

(略)

What is it about JavaScript that attracts so many literature devotees? I have a few half-baked theories
relating to the expressive potential of a limited syntax, but that’s for another time. What about the great
writers? What would they have made of JavaScript? Even as a long-time Hemingway nut, I’d be the first to admit
that Papa would probably have loathed programming (and programmers). Yet I’m betting that amongst all that
general contempt there would have lurked a soft spot for JavaScript, because it’s his kind of language, am I
right? A spare and deceptively plain surface, masking substance and drama beneath.

で、

Ernest Hemingway

function fibonacci(size) {

  var first = 0, second = 1, next, count = 2, result = [first, second];

  if(size < 2)
    return "the request was made but it was not good"

  while(count++ < size) {
    next = first + second;
    first = second;
    second = next;
    result.push(next);
  }
  return result;
}
William Shakespeare

function theSeriesOfFIBONACCI(theSize) {

  //a CALCKULATION in two acts.
  //employ'ng the humourous logick of JAVA-SCRIPTE

  //Dramatis Personae
  var theResult; //an ARRAY to contain THE NUMBERS
  var theCounter; //a NUMBER, serv'nt to the FOR LOOP

  //ACT I: in which a ZERO is added for INITIATION

  //[ENTER: theResult]

  //Upon the noble list bestow a zero
  var theResult = [0];

  //ACT II: a LOOP in which the final TWO NUMBERS are QUEREED and SUMM'D

  //[ENTER: theCounter]

  //Commence at one and venture o'er the numbers
  for (theCounter = 1; theCounter < theSize; theCounter++) {
    //By divination set adjoining members
    theResult[theCounter] = (theResult[theCounter-1]||1) + theResult[Math.max(0, theCounter-2)];
  }

  //'Tis done, and here's the answer.
  return theResult;

  //[Exuent]
}
Andre Breton

function Colette(umbrella) {
  var staircase = 0, galleons = 0, brigantines = 1, armada = [galleons, brigantines], bassoon;
  Array.prototype.embrace = [].push;

  while(2 + staircase++ < umbrella) {
    bassoon = galleons + brigantines;
    armada.embrace(brigantines = (galleons = brigantines, bassoon));
  }

  return armada;
}

Roberto Bolano

function LeonardoPisanoBigollo(l) {

  if(l < 0) {
    return "I'd prefer not to respond. (Although several replies occur to me)"
  }

  /**/

  //Everything is getting complicated.
  for (var i=2,r=[0,1].slice(0,l);i<l;r.push(r[i-1]+r[i-2]),i++)

  /**/

  //Here are some other mathematicians. Mostly it's just nonsense.

  rationalTheorists = ["Archimedes of Syracuse", "Pierre de Fermat (such margins, boys!)", "Srinivasa Ramanujan", "Rene Descartes", "Leonhard Euler", "Carl Gauss", "Johann Bernoulli", "Jacob Bernoulli", "Aryabhata", "Brahmagupta", "Bhaskara II", "Nilakantha Somayaji", "Omar Khayyám", "Muhammad ibn Mūsā al-Khwārizmī", "Bernhard Riemann", "Gottfried Leibniz", "Andrey Kolmogorov", "Euclid of Alexandria", "Jules Henri Poincaré", "Srinivasa Ramanujan", "Alexander Grothendieck (who could forget?)", "David Hilbert", "Alan Turing", "von Neumann", "Kurt Gödel", "Joseph-Louis Lagrange", "Georg Cantor", "William Rowan Hamilton", "Carl Jacobi", "Évariste Galois", "Nikolay Lobachevsky", "Rene Descartes", "Joseph Fourier", "Pierre-Simon Laplace", "Alonzo Church", "Nikolay Bogolyubov"]

  /**/

  //I didn't understand any of this, but here it is anyway.
  return r

  /**/

  //Nothing happens here and if it does I'd rather not talk about it.
}
Charles Dickens

function mrFibbowicksNumbers(enormity) {
  var assortment = [0,1,1], tally = 3, artfulRatio = 1.61803;

  while(tally++ < enormity) {
    //here is an exceedingly clever device
    assortment.push(Math.round(assortment[tally-2] * artfulRatio));
  }

  //should there be an overabundance of elements, a remedy need be applied
  return assortment.slice(0, enormity);
}

後ろ三人よく知らない ○| ̄|_

■_

2013年11月27日

■_

朝のミーティング。 始業後すぐに開始するんだけど、そうすると最新の情報が反映されてなかったりして (他部署や外部の人とのやり取りがあると思いねえ)、さてどうしたもんかいね。という。 まあ自分のいる部署じゃないのでぶっちゃけどうでもいいっちゃいいんだけど、 ミーティングを仕切ってる人が各自の割と詳しい情報を求めているっぽくて 今日なんか「準備が足りない」とかなんとかお小言言ってた。 でもさ、「始業前」にそのための準備してちゃまずいんじゃないの? 最近流行の「コンプライアンス」的にはさ (始業前に「仕事」やったら残業と同じ「時間外勤務」でそ)。 結局程度の問題ってことになるんすかね。

■_

■_

ということで進捗ありませんでした。 と言っておくことにしよう :)

2013年11月26日

■_

しばちゅーさん終わったー

■_

現役灘高生のLisperがイベントに登壇、「中学生にもLispを広めたい!」 最近は書籍「Types and Programming Languages」(通称TAPL、日本語訳は「型システム入門 -プログラミング言語と型の理論-」)の読書会を行っている。 中学生も読んでいる本を頭抱えながら読むの再開。 23章、チャーチエンコーディングの辺りから。

true が λt. λf. t、 false がλt. λf. f なのはまあなんとかそう言うものだと納得したとして、 not が λb:CBool. λX. λt:X. λf:X. b [X] f t なのが どうも良くわからんというかなんというか。 and なんてどうやるのやら(★一つ問題なのに…)

■_ 化

今日も今日とて重箱の隅を CloudFlare: Goで書いた安全にデータをやりとりする仕組み - ワザノバ | wazanova

CloudFlare: Goで書いた安全にデータをやりとりする仕組み - ワザノバ | wazanova

1) How to use it

Red Octoberサーバのセットアップは簡単。ローカルで読めるパスとSSLキーのペアがあればよい。後は、JSONベースのAPIを
介してリモート操作。

サーバは、パスワードのソルト化ハッシュ値のみを保管。

まずAPIを利用してデータを暗号化。その際に、ユーザのリストと、解読許可のための最低人数をセットします。データはど
こに保管してもよし。そのデータは後ほど、必要人数を満たす証明書がサーバに届けば、解読されるという仕組み。

「ソルト化ハッシュ値」ってなにーっ?! いやまあハッシュの計算するときに salt がでてくる(こともある)のは知ってますけどね。 「salt にする」わけじゃないんだから「化」はないと思うんだけどなあ。 ソルト化ハッシュ値 - Google 検索

あともう一つ「解読」を使ってるけど、ここは「復号」でいいんじゃなかろうか。 復号とは - 意味/解説/説明/定義 : IT用語辞典 暗号化やデータ圧縮などがされたデータから、元のデータを復元すること。 暗号の場合には、暗号化に用いた秘密の情報(暗号鍵)を用いて元のデータを得ることを意味し、 これを用いずに元の情報を復元することは「解読」という。 これはよく知らなかったけどw

Red October: CloudFlare’s Open Source Implementation of the Two-Man Rule | CloudFlare Blog

How to use it

Setting up a Red October server is simple; all it requires is a locally-readable path and an SSL key pair. After
that, all control is handled remotely through a set of JSON-based APIs.

Red October is backed by a database of accounts stored on disk in a portable password vault. The server never
stores the account password there, only a salted hash of the password for each account. For each user, the
server creates an RSA key pair and encrypts the private key with a key derived from the password and a randomly
generated salt using a secure derivation function.

Any administrator can encrypt any piece of data with the encrypt API. This request takes a list of users and the
minimum number of users needed to decrypt it. The server returns a somewhat larger piece of data that contains
an encrypted version of this data. The encrypted data can then be stored elsewhere.

This data can later be decrypted with the decrypt API, but only if enough people have delegated their
credentials to the server. The delegation API lets a user grant permission to a server to use their credentials
for a limited amount of time and a limited number of uses.

他にもあるけど今日はこれだけ

■_

なんかpart 8まであった(まだ見てない) A history of the Amiga, part 1: Genesis | Ars Technica

■_

2013年11月25日

■_

Apress も Cyber Monday のセールのお知らせ来ましたー Apress ってそれっぽいページないなあ… あった

The Pragmatic Bookshelf | Happy Thanksgiving: 50% off ebooks, All Week. pragprog も半額来たー しかも The coupon is valid Monday, November 25th, 2013, and expires Monday, December 2, 2013, PST. (That's 8 hours behind GMT.)

■_ めもめも

星野之宣を語れ Part16

581 名無しんぼ@お腹いっぱい [sage] 2013/11/25(月) 22:00:20.65 ID:ZNZ9bltpO Be:
    12月10日発売のビッグコミック読み切り掲載は宗像教授の新作です
    http://big-3.jp/bigcomic/image/yokoku/01.jpg

■_ StrangeLoop

javascript-science がなかなか。 Clojure core.async Javascript... FOR SCIENCE! Gershwin: Stack-based, Concatenative Clojure Add ALL the Things: Abstract Algebra Meets Analytics

■_

■_

ところどころどうにもうまくいかんなあ

Why not Go?

There are a few things about Go that I'm not super happy about, and that tend to bite me from time to time.

Go に関して super happy ではないことがらが幾つかあり、それはときどきわたしを bite する傾向にありました


First, you need to "know" whether the variable you are dealing with is an interface or a struct.
Structs can implement interfaces, of course, so in general you tend to treat these as the same thing. But when
you're dealing with a struct, you might be passing by reference, in which the type is *myStruct, or you might
be passing by value, in which the type is just myStruct. If, on the other hand, the thing you're dealing with
is "just" an interface, you never have a pointer to it -- an interface is a pointer in some sense.
It can get confusing when you're looking at code that is passing things around without the * to remember that
it might actually "be a pointer" if it's an interface rather than a struct.

まず、操作しようとしている変数が interface と struct のいずれであるかを「知る」必要があります。struct を使って
interface を実装することも当然できますから、一般的にはこれらは同一視される傾向にあります。しかしある struct を
扱うときにそれを by reference で渡すことがあるかもしれません。その場合に渡しているのは *myStruct という型です。
あるいは by value で渡すこともあるでしょう。そしてそのとき渡している型は myStruct そのものです。一方、the thing
you're dealing with is "just" an interface では、それを指すポインターを得ることは決してできません。なぜなら、
インターフェースとは a pointer in some sense だからです。このことは、*をつけた struct ではなく (*がない)
interface を渡しているコードに注目しているときに実はそれが"be a pointer" かもしれないことを思い出してしまって混
乱するかもしれません。


Go's type inference makes for lean code, but requires you to dig a little to figure out what the type of a given
variable is if it's not explicit. So given code like:

Go の型推論 type inference はコードを簡潔にしますが、与えられた変数が明示されていない場合にはその型がなんである
かを明らかにするために dig a little しなければなりません。ですから次のようなコードがあったとして

    foo, bar := someFunc(baz) 

You'd really like to know what foo and bar actually are, in case you want to add some new code to operate on
them. If I could get out of the 1970s and use an editor other than vi, maybe I would get some help from an IDE
in this regard, but I staunchly refuse to edit code with any tool that requires using a mouse.

foo や bar のような変数に対して操作を行う新しいコードを追加したいとなった場合、それらが一体どういう型なのかを
知りたくなるでしょう。1970年代から逃れてvi以外のエディターを使えるならば、この問題についてはおそらく IDE から何
らかの援助が得られるでしょう。しかしマウスを使わなければならないようなツールを使ってコードを編集するのをわたし
はごめん蒙るのです。


Finally, Go's liberal use of interfaces allows a struct to implement an interface "by accident". You
never have to explicitly declare that a given struct implements a particular interface, although it's good
coding style to mention this in the comments. The problem with this is that it can be difficult to tell when
you are reading a given segment of code whether the developer intended for their struct to implement the
interface that they appear to be projecting onto it. Also, if you want to refactor an interface, you have to go
find all of its (undeclared) implementations more or less by hand.

Finally, Go の liberal use of interfaces は "by accident" の interface の実装をを許してしまいます。プログラマー
は与えられた struct で particular interface を実装することを (コメントで言及しておくのが good coding style では
ありますが) explicitly に宣言する必要はありません。このことで問題なのは、プログラマーが a given segment of code
を読んだときに struct が interface を実装しているのが developer の意図したものなのかどうか宣言がないために判断
するのが難しくなってしまう可能性があるということです。また、interface のリファクタリングをしようとした場合に、
多かれ少なかれ手作業によってその (宣言されていない) 実装のすべてを探し出さなければなりません。


Most of all I find coding in Go really, really fun. This is a bad thing, since we all know that "real"
programming is supposed to be a grueling, painful exercise of fighting with the compiler and tools. So programming
in Go is making me soft. One day I'll find myself in the octagon ring with a bunch of sweaty, muscular C++ 
programmers bare-knuckling it out to the death, and I just know they're going to mop the floor with me. That's
OK, until then I'll just keep on cuddling my stuffed gopher and running gofmt to auto-intent my code.

Most of all I find coding in Go はとてもとてもたのしいものです。しかしこれは bad thing なのです。なぜなら、
"本物の" プログラマーはコンパイラーやツールとの厳しく辛い exercise of fighting に耐えることが当然だと思われて
いることをわたしたちは皆理解しているからです。ですから Go でのプログラミングはわたしを soft にさせるのです。
いつの日かわたしは気がつくでしょう。自分が八角形のリングの上にいて sweaty で muscular なC++プログラマーの集団と
素手での殴り合いをしていて、まさに彼らがわたしを打ち負かそうとしていることに。
That's OK, until then I'll just keep on cuddling my stuffed gopher and running gofmt to auto-intent my code.

■_ 情報技術者の社会的責任

情報技術者の社会的責任 第9話 from Hiroki Kashiwazaki
サリンジャーが出てきた辺りからの流れが良いですね(上から 情報技術者の社会的責任 第9話

2013年11月24日

■_

数学勉強会だいぶ遅れが(^^; スライドまるごと紙に印刷したいんだけど一枚ずつしかできないのよねえ (オンラインだと時間取れないのよ)

manning さんから結構買ってた

ほぼすべてなにかのセールで買ったとはいえ思ったより数があってびっくりした

久しぶりに池袋のジュンク堂へ。 けっこうな量買ったんだけど緑のジュンク堂袋じゃなかった ○| ̄|_ 前回は今日よりも少ない量でジュンク堂袋になったんだけど基準がわからん (人によるのかもしれない)。

そしてピンクレシートのことをすっかり忘れていたことに気がつく。 秋の読書キャンペーン|イベント・フェア詳細 | 丸善&ジュンク堂ネットストア トートバッグ欲しかった

んでもう一つ気がついたこと。チューリング本こんなことになっていたとは 2013年|お知らせ一覧|NTT出版 2013年11月に刊行いたしました『チューリング ――情報時代のパイオニア』(ISBN978-4-7571-0335-1)の「訳者解説」等の一部において、制作上の不備があり不完全な書籍として出版致しておりました。  そこで、当該書籍は現在回収をさせていただいております。また、同時に新版制作をすすめており、12月上旬に刊行する予定でございます。 むしろ手元に残しておきたい気がしないでもない。

■_ OSのソースコードとか

OpenBSD は見たことないなあ確か。 興味はあるんだけども。OpenBSD といえば最近こんな本が出てますが Absolute Openbsd: Unix for the Practical Paranoid
Absolute Openbsd: Unix for the Practical Paranoid kindle 版だと半額くらいになってますね 紙の本の価格: ¥ 6,218 Kindle 価格: ¥ 2,754 OFF: ¥ 3,464 (56%) Absolute OpenBSD: Unix for the Practical Paranoid
Absolute OpenBSD: Unix for the Practical Paranoid 実際どうなのかは分かりません (前にも書いたと思うけど、amazon で kindle 版のみというのはあまり買う気が起こらないのです)。

「○○の歴史プロジェクト」を進める人たちのBoF開催のお知らせ - JPNIC 2013年11月26日(火) 18:45~20:15 がーん行けねえー ○| ̄|_

JR 渋谷駅の山手線内回りのホーム、一番恵比寿よりの階段から下りてすぐのところにある ジュース類を売ってるお店、以前はミネストローネを(冬場限定ですが)売ってたのだけど ここ3シーズンくらいみていない。 モスバーガーでもミネストローネなくなってるぽいし何があった。 2013/11/17「モスのミネストローネと大和タカキの愛され具合は異常」|麻婆豆腐は食べ物です。

■_ OCaml

The OCaml installer for Windows

あらら。

■_

■_

Raspberry Pi スレッドが盛り上がってた

【Raspberry Pi】ラズベリー・パイ part5 【ARM】

511 login:Penguin [sage] 2013/11/22(金) 12:14:27.07 ID:ClBa4c8/ Be:
    mathematicaが無料でつくとな。
    http://news.mynavi.jp/news/2013/11/22/025/ 

512 login:Penguin [sage] 2013/11/22(金) 12:37:06.43 ID:8qCzDdET Be:
    つ http://www.raspberrypi.org/archives/5282 

513 login:Penguin [sage] 2013/11/22(金) 13:20:37.20 ID:Bzw+jdE2 Be:
    ますます学習教材として発展していくな。
    良い事だ。 

517 login:Penguin [sage] 2013/11/22(金) 19:30:37.12 ID:mH+WgGR2 Be:
    Maximaがあるやないの 

518 login:Penguin [sage] 2013/11/22(金) 19:33:40.29 ID:LvkmQFxe Be:
    いかにRasPiが非実用的な性能の玩具だと思われてるかということだな
    なんとかして外部のCPUに処理を肩代わりさせられたらいいのにね 

519 login:Penguin [sage] 2013/11/22(金) 20:50:01.36 ID:ANfBRkph Be:
    >>518
    並列処理とか簡単に出来たら素敵なのにね 

520 login:Penguin [sage] 2013/11/22(金) 21:36:14.63 ID:LvkmQFxe Be:
    >>519
    OpenMPI使えばいいじゃない
    まあRPiたくさん並べるよりその金でx64 PC買った方が速いと思うけど 

521 login:Penguin [sage] 2013/11/22(金) 22:47:35.34 ID:+a2vCOq8 Be:
    クリエイター御用達ツールの次にぼったくりなあのマセマティカさんが無料バンドルされるっていう大ニュースで
    Twitterやはてぶでもバズってるのに嫌儲やニュー速やPCニュースを一通り見てきて一つもスレが立ってないのにびっくり
    Linux板以外のネラーはラズパイに興味ないのか? 

526 login:Penguin [sage] 2013/11/23(土) 08:32:36.68 ID:O+Wu6GW4 Be:
    らずぱぃわぁ
    もっとはゃってもぃいとぉもうのぉ 

527 login:Penguin [sage] 2013/11/23(土) 09:20:36.40 ID:rxzfPCv0 Be:
    >>521
    まずラズパイに興味あるネラーって少ないじゃん
    このスレもそんな勢いないし
    それに大学や研究等でmathematicaと関わりがある人ってとこでも絞られるし

    そもそもそういう系の層はネラー率少ないイメージがある
    いても普通の人は嫌儲等にスレ立てできないし 

528 login:Penguin [sage] 2013/11/23(土) 10:18:10.77 ID:1MQIUk6O Be:
    スレ2,3個あってレスもそこそこ付いてるのに勢いないとな 

529 login:Penguin [sage] 2013/11/23(土) 11:07:46.13 ID:Z4TBQDSZ Be:
    というかデスクトップ用途でRaspberry Pi使ってる奴あんまいないからじゃね?
    他のマシンから操作できるRemote Development toolとやらが出れば変わるかもしれん 

530 login:Penguin [sage] 2013/11/23(土) 11:59:18.85 ID:pLdCa2Dm Be:
    ラズパイは教育用つっても、中高生向きの教材だよな。
    Mathematicaを必要とする奴がPCを使えない環境にあるとかちょっと想像できない。
    学研とかと組んで、もっと本来のターゲット層に売り込めば良いのに。
    大人にとっては、やはりおもちゃでしかない。 

531 login:Penguin [sage] 2013/11/23(土) 12:21:44.51 ID:rxzfPCv0 Be:
    >>530
    mathematicaを必要としてる人ではなく
    今までmathematicaと縁が無かった層(小中高生とか)がガチのツールで遊べるっていうところに大きな意味があるんじゃ…

    プログラミング(Scrach,python)、数学(mathematica&wolfram language)が揃った、
    あとは科学の何かがあれば理系人間養成マシンの出来上がり 

533 login:Penguin [sage] 2013/11/23(土) 13:20:13.51 ID:pLdCa2Dm Be:
    >>531
    なるほどな。それはそうかも。 

534 login:Penguin [sage] 2013/11/23(土) 13:28:34.40 ID:7zp6vRO7 Be:
    要は販促だよね。
    数年後、その学生達がこういうのを本当に必要とする頃には「Maximaなんて使えねー」ってなる。 

535 login:Penguin [] 2013/11/23(土) 14:39:57.27 ID:v/ZK20VC Be:
    Mathematica使えたけど遅ぇぇぇwww 

536 login:Penguin [] 2013/11/23(土) 14:44:08.31 ID:0Cna2F0q Be:
    >>535
    wwwww 

539 login:Penguin [sage] 2013/11/23(土) 17:24:11.78 ID:rxzfPCv0 Be:
    いざmathematica起動して見たけど
    maximaとの違いがよくわからない
    http://i.imgur.com/Jkeyg0a.jpg


    >>537
    apt-get update && apt-get install wolfram-engine でOK 

541 login:Penguin [sage] 2013/11/23(土) 17:46:00.25 ID:uMPmZdFD Be:
    >>539
    インストールして起動したけどターミナルからの起動でそんなguiないぞ?
    どっから起動するん? 

542 login:Penguin [sage] 2013/11/23(土) 17:50:47.76 ID:pacxpl8w Be:
    wolfram-engine 207MBもある 

543 login:Penguin [sage] 2013/11/23(土) 17:56:49.75 ID:rxzfPCv0 Be:
    >>541
    普通にGUIメニューのeducationカテゴリーに入ってるけど… 

544 login:Penguin [sage] 2013/11/23(土) 18:37:18.86 ID:uMPmZdFD Be:
    >>543
    日本語で言うと?
    おれ日本語化してるから
    startxでメニューでプログラムでWolframかい? 

545 login:Penguin [] 2013/11/23(土) 18:43:36.02 ID:oKHNBpIL Be:
    PCでRasPiエミュすればタダでMathematica手に入る。 

546 login:Penguin [sage] 2013/11/23(土) 18:55:14.23 ID:TSsdMk8H Be:
    人によっては、Mathematicaのアイコンがねーよ、という状況らしいけど
    ttp://www.raspberrypi.org/archives/5282#comments
    の、11.から続くコメントツリーを読むとなんとかなるかもよ 

547 login:Penguin [sage] 2013/11/23(土) 19:08:55.04 ID:/1ATGf3z Be:
    MathematicaのVer.3の学生版を3万円で買った思い出
    キージェネを使えば今でも使えるはず・・・だけど、そんな高度なことはしてないのでMaximaでいいわ 

548 login:Penguin [sage] 2013/11/23(土) 19:11:51.50 ID:lHCVsS9X Be:
    PCでエミュレーションてこれか。
    qemuベースだから実機より遅いぉ

    http://sourceforge.net/projects/rpiqemuwindows/ 

549 login:Penguin [sage] 2013/11/23(土) 19:19:24.91 ID:tA3U5qCX Be:
    Mathemaの重い処理とやらを
    リモホのPC側でできないのか? 

550 login:Penguin [sage] 2013/11/23(土) 19:44:00.52 ID:lHCVsS9X Be:
    >>549
    これやったら?

    http://www.hirax.net/diaryweb/2011/11/05.html#9882 

551 login:Penguin [sage] 2013/11/23(土) 20:24:44.68 ID:pacxpl8w Be:
    $ mathematica
    Can't open display ""


    本当に、ありがとうございました。 

552 login:Penguin [sage] 2013/11/23(土) 20:25:04.91 ID:OW5X5jwf Be:
    我々みたいなPC8001からパソコン弄ってた奴らと違って
    最近の子供は目が肥えてるからなぁ

    今日は小学生の娘から32GBのSDカードをせがまれて買わされた
    俺の時代は32KBだの64KBだったのだと懇々と話したが完全無視 

553 login:Penguin [] 2013/11/23(土) 20:25:30.21 ID:oKHNBpIL Be:
    http://i.imgur.com/ouk2Bg4.jpg
    動いた。
    iPad miniからリモートです。
    遅いね。 

■_

どの本だろう。ちょっと気になるw

■_ Basic Data Structures and Algorithms in the Linux Kernel

Basic Data Structures and Algorithms in the Linux Kernel まとめることになった発端は stackexchange での質問だとか。

The Phrygian Cap

Thanks to Vijay D'Silva's brilliant answer in cstheory.stackexchange.com I have been reading some of the
famous data structures and algorithms used in the Linux Kernel. And so can you.

Links based on linux 2.6:

    Linked lists, doubly linked lists, lock-free linked lists.
    B+ Trees with comments telling you what you can't find in the textbooks.
    Priority sorted lists used for mutexes, drivers, etc.
    Red-Black trees are used are used for scheduling, virtual memory management, to track file descriptors and directory entries, etc.
    Interval trees.
    Radix trees, are used for memory management, NFS related lookups and networking related functionality.
    Priority heap, which is literally, a textbook implementation, used in the control group system.
    Hash functions, with a reference to Knuth and to a paper.
    Some parts of the code, such as this driver, implement their own hash function.
    Hash tables used to implement inodes, file system integrity checks, etc.
    Bit arrays, which are used for dealing with flags, interrupts, etc. and are featured in Knuth Vol. 4.
    Semaphores and spin locks.
    Binary search is used for interrupt handling, register cache lookup, etc.
    Binary search with B-trees.
    Depth first search and variant used in directory configuration.
    Breadth first search is used to check correctness of locking at runtime.
    Merge sort on linked lists is used for garbage collection, file system management, etc.
    Bubble sort is amazingly implemented too, in a driver library.
    Knuth-Morris-Pratt string matching.
    Boyer-Moore pattern matching with references and recommendations for when to prefer the alternative.

KMP があるんですね。どこで使ってるんだろ。 linux-2.6/lib/ts_kmp.c at b3a3a9c441e2c8f6b6760de9331023a7906a4ac6 · mirrors/linux-2.6 ふむ。

え、バブルソートがある。

■_

おー、これは素晴らしい (丸ごと翻訳はまあ無理だろう)。 GitHub: Tom Preston-Wernerが語る「幸せの最適化」 - ワザノバ | wazanova Tesla & SpaceX: Elon Muskが語る人並みはずれた未来観 - ワザノバ | wazanova Dropbox: Drew Houstonが語る自分のサービスへの信念 - ワザノバ | wazanova Evernote: Phil Libinが語る自分のためのプロダクトをつくるということ - ワザノバ | wazanova

■_

なぞのめも Type erasure — Part I | Andrzej's C++ blog Python - The Best First Programming Language : programming cortesi - How I Learned to Stop Worrying and Love Golang Is it a Good Idea to Write Tests for Legacy Code? | Stephen Haunts { Coding in the Trenches }

2013年11月23日

■_

チューリング主役の映画? Upcoming Film About Alan Turing : programming Benedict Cumberbatch in line to play Alan Turing in The Imitation Game | Film | theguardian.com

で、チューリングといえば例の本なのですが細かいところで色々気になるところがありまして。 「苦いアーモンド」というのが最後の方で何度か出てくるのですが わざわざ「苦い」ってくっついてるのはなんだろうかと疑問に思ったわけです。 調べてみるとアーモンドってのは大きく分けて二種類あるんだとか アーモンド - Wikipedia スイート種(甘扁桃)とビター種(苦扁桃)があり、食用にされるのはスイート種である。 さて、チューリングの死因は青酸中毒とされています(自殺かどうかはさておき アラン・チューリング - Wikipedia ) そしてよく聞く話ですが青酸カリは「アーモンドのにおい」がするのだとか(実は青酸カリそのものの匂いではないらしいですね 青酸カリはアーモンド臭? - Yahoo!知恵袋)。 青酸カリが胃酸に反応して出た青酸ガスのアーモンド臭とは「苦扁桃臭」、ビター・アーモンドの臭い 原文に当たらないと何とも言えないのですが、 「bitter almond」をそのまま「苦いアーモンド」にしちゃったんですかねえ。 Almond - Wikipedia, the free encyclopedia

他にも細々あるんですが面白かったですよ。はい。 チューリング: 情報時代のパイオニア

nginx。 のソースコード(Cで書かれてる?) が 非常に綺麗だというのを伝え聞いたので(どこで誰からだかは忘れたw) 今度読んでみよう。 と日記には書いた。 nginx: download

■_

メモ的に。

■_ Wolfman Language

温度差あるなー Wolfram Language and Documentation Center : programming Wolfram Language | Hacker News

■_

ruby-trunk-changes r43766 - r43803 - PB memo

ruby-trunk-changes r43766 - r43803 - PB memo

nobu:r43775 2013-11-22 12:43:56 +0900

文字列の浮動小数点数をパースする時に非常に長い文字列を読み込ませると精度的に意味のない桁まで真面目に処理して
しまって非常に長い計算時間がかかっていたので適度なところで打ち切るようにしています。これは String#to_f などで
数値化する時に長い文字列を渡すことで CPU 時間を食い潰すので JSON のパースなど Web アプリケーションでパラメー
タとして受け取った文字列を Float としてパースしようとするケースで DoS 攻撃のターゲットとなり得ることから脆弱性
の対策としてコミットされました。より一般的には http サーバやフレームワークでパラメータの長さを制限するなどの対
策も考えられます。

このコミットを受けて 2.0.0-p353 および 1.9.3-p484 がリリースされました。

おお、そういうものだったのか。

■_

2013年11月22日

■_

オライリーの Cyber Monday セールのお知らせ。 そういやそんなんあったな> Cyber Monday 皆さん要チェックということで。 Cyber Monday Special - O'Reilly Media Cyber Monday is the first Monday after Thanksgiving, but since you're here now, we wanted you to know about the current deals available for you. Be sure to bookmark this page for our annual Cyber Monday special offer. It's an exciting day to shop, and we'll have a special one-day-only offer on thousands of titles. サイバーマンデー - Wikipedia 日本では2012年にAmazon.co.jpが12月第2月曜日を日本版のサイバーマンデーとして日本記念日協会に申請し、認定された[4]。 へえ。

manning とか apress とか springer とか no starch とかはまだー?

■_

今日のニュースといえばこれでしょう RasberryPi、数式処理ソフト「Mathematica」を同梱。個人利用は無料 -INTERNET Watch Raspberry Pi、「Wolfram Language」と「Mathematica」を無料バンドル | マイナビニュース Putting the Wolfram Language (and Mathematica) on Every Raspberry Pi—Stephen Wolfram Blog The Wolfram Language and Mathematica on Raspberry Pi, for free | Raspberry Pi Putting the Wolfram Language (and Mathematica) on Every Raspberry Pi—Stephen Wolfram Blog : programming Mathematica on Raspberry Pi for free | Hacker News RaspberryPiを買うとMathematicaがついてくる | スラッシュドット・ジャパン ハードウェア

HN での反応から一つ

Timeo Danaos et dona ferentes... I fear the Greeks even when they bring gifts...... | Hacker News

Timeo Danaos et dona ferentes... I fear the Greeks even when they bring gifts...

I don't get it... Wolfram is a money-hungry egomaniac. For example, unlike the other big Ma competitors (Maple,
Matlab, Magma) not a single source line of Mathematica code is exposed. He's litigious, he labels everthing
"mine", he endlessly praises himself. He wrote this insulting "don't worry your pretty little
head with our source code, it's too complicated for you" piece:

http://reference.wolfram.com/mathematica/tutorial/WhyYouDoNotUsuallyNeedToKnowAboutInternals.html

So... gratis Mathematica on Raspbian... what's the catch? Is it to lure us to the cloud?

http://www.wolframcloud.com/

Edit: To clarify, my guess here is that they want to give people a taste of Mathematica on weak hardware in
order to lure them to a subscription model on "the cloud" where much more processing power will be
available, just like widespread university site-wide licenses and turning a blind eye to student piracy are
great marketing strategies.

Is there any evidence to support my wild theories?

どう使うのかまだあまり良くイメージ湧かないのだけど。 それと↑のコメントで言及されていることは自分も(程度の差はあるけれども) 考えたりすることはあって、とはいえ free software (や open source) にしろというのも 何か違う気もしてどうしたものかねえと(投げっぱなしジャーマン)

■_ TOP10

From the IEEE Computer Society Journal: The Top 10 Algorithms from the 20th century : programming Guest Editors' Introduction: The Top 10 Algorithms

Guest Editors' Introduction: The Top 10 Algorithms

We tried to assemble the 10 algorithms with the greatest influence on the development and practice of science
and engineering in the 20th century. Following is our list (here, the list is in chronological order; however,
the articles appear in no particular order):

    • Metropolis Algorithm for Monte Carlo

    • Simplex Method for Linear Programming

    • Krylov Subspace Iteration Methods

    • The Decompositional Approach to Matrix Computations

    • The Fortran Optimizing Compiler

    • QR Algorithm for Computing Eigenvalues

    • Quicksort Algorithm for Sorting

    • Fast Fourier Transform

    • Integer Relation Detection

    • Fast Multipole Method

よくわからんのがいくつかある ○| ̄|_

■_ Emacs に

どういった機能を追加したらいいかというおはなし 25 years ago I hoped we would extend Emacs to do WYSIWG word processing | Hacker News Emacs as word processor

Emacs as word processor

Emacs as word processor
From: 	Richard Stallman
Subject: 	Emacs as word processor
Date: 	Sun, 17 Nov 2013 02:28:51 -0500

25 years ago I hoped we would extend Emacs to do WYSIWG word
processing.  That is why we added text properties and variable width
fonts.  However, more features are still needed to achieve this.

Could people please start working on the features that are needed?

そしてこういった意見が

With inline LaTeX previews, we're already surprisingly close. In fact, I'd say ... | Hacker News

With inline LaTeX previews, we're already surprisingly close. In fact, I'd say that going all the way would be
almost a step back. WYSIWYG is ultimately not an ideal editing paradigm: it wins in the short term, being easy
to learn, but drags you down in the long term.

I've recently started using Quora a bit more. Unlike StackOverflow, they use a WYSIWYG editor. I've found this
significantly less convenient than StackOverflow's markdown. Similarly, switching from Word to LaTeX was an
improvement for most tasks once I got used to it.

Unfortunately, LaTeX has a bunch of its own shortcomings not related to it's non-WYSIWYG nature. For common
tasks, I think going from markdown to LaTeX is ideal. Markdown itself is far from perfect, but it's the best
compromise I've found especially with Pandoc's extensions.

So here's my idea for a great emacs-based document editor: markdown with inline math previews coupled with a
full live preview to the side. All the necessary modes for this already exist (like whizzy TeX and AucTeX's
previews), so it should be much easier to put together than a full WYSIWYG editor. More productive, too.

ま、LaTeX に限らず欲しいところではありますね。 Emacs で丸ごと抱えるかどうかはさておき。

■_

2013年11月21日

■_

いらいら

■_

例によって「抄訳」なんですね。

規模の大きい本番システムをGo言語で書き直した感想 - ワザノバ | wazanova

Go言語の4周年をテーマにしたgolang.orgのブログで紹介されていた、GoogleのMobile Web Performanceチームに所属する
Matt Welshのブログです。大規模な本番システムの作り直しにGo言語を採用した経験を語っています。


    1) 背景

    C++のオリジナルのコードベースは問題なく作動していたが、何年も複数の目的の違うプロジェクトで共有されていたた
    め、スピーディーに改修するのが難しくなっていた。(何のシステムなのか具体的に書いてないのは残念。。)

    イメージフォーマットをトランスコードするライブラリはC++で完璧に動作していたので、そのまま残し、それ以外を全
    てGo言語で書き直した。

    元のコードベースの20%を利用すれば機能としては十分だとわかり、コアロジックの大胆な改修にも手をつけたかった。
Volatile and Decentralized: Rewriting a large production system in Go

Rewriting a large production system in Go

My team at Google is wrapping up an effort to rewrite a large production system (almost) entirely in Go. I say
"almost" because one component of the system -- a library for transcoding between image formats --
works perfectly well in C++, so we decided to leave it as-is. But the rest of the system is 100% Go, not just
wrappers to existing modules in C++ or another language. It's been a fun experience and I thought I'd share
some lessons learned.

Plus, the Go language has a cute mascot ... awwww!

Why rewrite?

The first question we must answer is why we considered a rewrite in the first place. When we started this
project, we adopted an existing C++ based system, which had been developed over the course of a couple of years
by two of our sister teams at Google. It's a good system and does its job remarkably well. However, it has been
used in several different projects with vastly different goals, leading to a nontrivial accretion of cruft.
Over time, it became apparent that for us to continue to innovate rapidly would be extremely challenging on this
large, shared codebase. This is not a ding to the original developers -- it is just a fact that when certain
design decisions become ossified, it becomes more difficult to rethink them, especially when multiple teams are
sharing the code.

Before doing the rewrite, we realized we needed only a small subset of the functionality of the original system
-- perhaps 20% (or less) of what the other projects were doing with it. We were also looking at making some
radical changes to its core logic, and wanted to experiment with new features in a way that would not impact the
velocity of our team or the others using the code. Finally, the cognitive burden associated with making changes
to any large, shared codebase is unbearable -- almost any change required touching lots of code that the
developer did not fully understand, and updating test cases with unclear consequences for the other users of the
code.

So, we decided to fork off and do a from-scratch rewrite. The bet we made was that taking an initial productivity
hit during the initial rewrite would pay off in droves when we were able to add more features over time. It has
also given us an opportunity to rethink some of the core design decisions of our system, which has been extremely
valuable for improving our own understanding of its workings.

まずはここ。大部分量が違うので情報が結構抜け落ちてるのはまあ仕方ないにしても 「元のコードベースの20%を利用すれば」と言う書き方だと、元プロジェクトのコードそのものを使うってことに なりませんでしょうか。この20%云々は 「we needed only a small subset of the functionality of the original system -- perhaps 20% (or less) of what the other projects were doing with it.」 small subset の規模ですよね。そもそもの話がGo で全面的に書き直した (So, we decided to fork off and do a from-scratch rewrite.) なんだから。

    2) Why Go?

    当初不安だったことがいくつかあった。この本番システムは、ユーザとそのコンテンツの橋渡しの役割をもってるので、
    早くなくてはいけない。また、大量のクエリを扱うのでCPU/メモリ効率が鍵となる。Go言語がガベージコレクタに頼って
    ることは、メモリ容量のコントロールに苦労するのではないかという不安を抱いた。このシステムでは依存関係が多いの
    で、C++で完成しているたくさんのライブラリを全部Goで書き直さなくてはいけないことも負担であった。

    しかし、コアシステムをGo言語で書き直す最初のコードを見たとき、優秀なエンジニアが1週間以内でやった作業であっ
    たが、Go言語の可読性に感心した。C++の場合、数十のソースファイルにまたがった非同期コールバックのチェーンが、
    goroutineのおかげで、数百行のコードで一つのファイルにまとめることができた。また、
    HTTP/URL処理/ソケット/暗号化/日付 & タイムスタンプの処理/データ圧縮など、web開発に適した標準ライブラリが
    揃っている。しかも、コンパイル言語なので処理が早く、これは大型のプロジェクトではメリットが大きい。Goのモジュ
    ールデザインでは、コードがモジュール間でうまくわかれ、依存関係がわかりやすい。
Why Go?

I'll admit that at first I was highly skeptical of using Go. This production system 
sits directly on the serving path between users and their content, so it has to be 
fast. It also has to handle a large query volume, so CPU and memory efficiency are key. 
Go's reliance on garbage collection gave me pause (pun intended ... har har har), 
given how much pain Java developers go through to manage their memory footprint. Also, 
I was not sure how well Go would be supported for the kind of development we wanted to 
do inside of Google. Our system has lots of dependencies, and the last thing I wanted 
was to have to reinvent lots of libraries in Go that we already had in C++. Finally, 
there was also simply the fear of the unknown.

My whole attitude changed when Michael Piatek (one of the star engineers in the group) 
sent me an initial cut at the core system rewrite in Go, the result of less than a 
week's work. Unlike the original C++ based system, I could actually read the code, 
even though I didn't know Go (yet). The #1 benefit we get from Go is the lightweight 
concurrency provided by goroutines. Instead of a messy chain of dozens of asynchronous 
callbacks spread over tens of source files, the core logic of the system fits in a 
couple hundred lines of code, all in the same file. You just read it from top to 
bottom, and it makes sense.

Michael also made the observation that Go is a language designed for writing Web-based 
services. Its standard libraries provide all of the machinery you need for serving 
HTTP, processing URLs, dealing with sockets, doing crypto, processing dates and 
timestamps, doing compression. Unlike, say, Python, Go is a compiled language and 
therefore very fast. Go's modular design makes for beautiful decomposition of code 
across modules, with clear explicit dependencies between them. Its incremental 
compilation approach makes builds lightning fast. Automatic memory management means 
you never have to worry about freeing memory (although the usual caveats with a 
GC-based language apply).

「Our system has lots of dependencies, and the last thing I wanted was to have to reinvent lots of libraries in Go that we already had in C++.」 が 「C++で完成しているたくさんのライブラリを全部Goで書き直さなくてはいけないことも負担であった。」 はちと。「負担だった」はどこから? 原文の一つ前の文を見ても 「I was not sure how well Go would be supported for the kind of development we wanted to do inside of Google.」 だし。 で、この段落は I was highly skeptical、 gave me pause 、 I was not sure、 ときて「Finally, there was also simply the fear of the unknown.」 なんだから、負担という単語を持ち出すにしても負担が大きいことも不安要素だったくらいに なるんじゃないかなあ。

訳文の後段も 「しかし、コアシステムをGo言語で書き直す最初のコードを見たとき、優秀なエンジニアが1週間以内でやった作業であっ たが、Go言語の可読性に感心した。」 は元が 「My whole attitude changed when Michael Piatek (one of the star engineers in the group) sent me an initial cut at the core system rewrite in Go, the result of less than a week's work.」で、ここには可読性なんて出てこないんですよね。出てくるのは次の文で 「Unlike the original C++ based system, I could actually read the code, even though I didn't know Go (yet).」 この二つを混ぜて(それ自体は良いとしても)、「可読性に感心した」が出てくるのはやっぱりわからない。 あと Michael Piatek さん名前消されて気の毒。 さらに、 「C++の場合、数十のソースファイルにまたがった非同期コールバックのチェーンが、 goroutineのおかげで、数百行のコードで一つのファイルにまとめることができた。」 (読点の使い方なんかも一言言いたいけどスルーして)についても 原文の「lightweight concurrency provided by goroutines.」 から goroutine だけ取り出すのはGoを知らない人には不親切でしょう。

原文の三段落目に対応する文は…なんというか 「Michael also made the observation」というのがどっか行っちゃって

    3) Being terse

    長い変数名で何行にも渡ってコードを書くのに慣れていたので、Go言語の簡潔なスタイルに最初は戸惑ったが、結果、
    可読性があがり、スピードアップしたので感謝している。雛形構文をたくさん書かなくてもいいし、C++のようにヘッダ
    ーファイルとccファイルにロジックを分けなくてもよい。また、Javaと違って、コンパイラーが推察できるもの(変数
    のタイプとか)を何でも書いたりする必要がない。Pythonのような簡潔なスクリプト言語を書いてる感覚で、タイプセ
    ーフを実現できます。

    最終的には、Go言語で、21,000行、121ファイルのコードベスになった。オリジナルのC++は、460,000行、1,400ファイル。
    もちろんこの差分は、機能を一部に絞り書き直した結果であるが、機能の削減以上にコードは減ったという感覚がある。
Being terse

Syntactically, Go is very succinct. Indeed, the Go style guidelines encourage you to 
write code as tersely as possible. At first this drove me up the wall, since I was 
used to using long descriptive variable names and spreading expressions over as many 
lines as possible. But now I appreciate the terse coding approach, as it makes reading 
and understanding the code later much, much easier.

Personally, I really like coding in Go. I can get to the point without having to write 
a bunch of boilerplate just to make the compiler happy. Unlike C++, I don't have to 
split the logic of my code across header files and .cc files. Unlike Java, you don't 
have to write anything that the compiler can infer, including the types of variables. 
Go feels a lot like coding in a lean scripting language, like Python, but you get type 
safety for free.

Our Go-based rewrite is 121 Go source files totaling about 21K lines of code 
(including comments). Compare that to the original system, which was 1400 C++ source 
files with 460K lines of code. (Remember what I said about the new system implementing 
a small subset of the new system's functionality, though I do feel that the code size 
reduction is disproportionate to the functionality reduction.)

「コンパイラーが推察できる」「compiler can infer」は「型推論(type inference)」を考えれば 推論の方がいいんじゃないすかね。で、 「また、Javaと違って、コンパイラーが推察できるもの(変数のタイプとか)を何でも書いたりする必要がない。」 「Unlike Java, you don't have to write anything that the compiler can infer, including the types of variables. 」 これは「Java とは違って、変数の型のようにコンパイラーが推論可能なものは(一切)書く必要がない。」 くらいでいいのでは。

「スピードアップしたので感謝している。」 これはどこから出てきたんだろう… 「感謝している」だから But now I appreciate the terse coding approach, as it makes reading and understanding the code later much, much easier. この辺?

    4) What about ramp-up time?

    標準ライブラリのドキュメントやオンラインチュートリアルが充実しているので、C言語系の経験がある人にはすぐに
    キャッチアップできる。

    今回のプロジェクトは、書き直しと、3 or 4 件の新機能追加で、全部で5ヶ月。新しいコードベースへの移行で生産
    性は大幅アップ。
What about ramp-up time?

Learning Go is easy coming from a C-like language background. There are no real 
surprises in the language; it pretty much makes sense. The standard libraries are very 
well documented, and there are plenty of online tutorials. None of the engineers on 
the team have taken very long at all to come up to speed in the language; heck, even 
one of our interns picked it up in a couple of days.

Overall, the rewrite has taken about 5 months and is already running in production. We 
have also implemented 3 or 4 major new features that would have taken much longer to 
implement in the original C++ based system, for the reasons described above. I 
estimate that our team's productivity has been improved by at least a factor of ten by 
moving to the new codebase, and by using Go.

「C言語系の経験がある人にはすぐにキャッチアップできる。」は 端折りすぎというかまとめすぎというか。 「None of the engineers on the team have taken very long at all to come up to speed in the language; heck, even one of our interns picked it up in a couple of days.」 せめてチームではそうだったということで「キャッチアップできた」にはすべきかと。

「that would have taken much longer to implement in the original C++ based system, for the reasons described above. I estimate that our team's productivity has been improved by at least a factor of ten by moving to the new codebase, and by using Go.」 が 「新しいコードベースへの移行で生産性は大幅アップ。」 はなんでそうなるのという感じ。

そして今回のメイン

    5) Why not Go?

    Goで苦労していることは、

    まず、自分が扱っている変数がinterfaceかstructか理解してなくてはいけない。もちろんstructはinterfaceをインプ
    リできるので、一般的には同じものと扱える。しかし、structを扱っているとき、*myStructというタイプの参照を渡さ
    れるかもしれないし、mStructというタイプの変数を渡されるかもしれない。一方で、もし単なるinterfaceを扱ってい
    たら、それはポインタをもたない。ある意味interfaceがポインタだから。structでなくinterfaceだった場合、* をつ
    けないで渡しているコードを見て実はポインタかもしれないと思わなければいけないことで混乱するかもしれない。

    Goのタイプを推察するスタイルは簡潔なコードになるが、どのタイプの変数なのかが明示されてなければ、調べなくて
    はいけなくなる。例えば、foo, bar := someFunc(baz) として、もしfooとbarを操作するためにコードを書き足したい
    のであれば、fooとbarが何なのか確認しなくてはいけない。(IDEでできるのかも知れないが、コードを書くときにマウ
    スを使うのはイヤ。)

    また、意図せずにstructがinterfaceをインプリしてしまうことがある。structがどのinterfaceをインプリするのか明
    示する必要がない。これはコードにコメントを残しておくべきだが、他人のコードを読んだときに意図がわかりづらく
    なる。また、interfaceをリファクタリングするときに宣言されてないインプリも含めて全て確認しなくてはいけなくなる。
Why not Go?

There are a few things about Go that I'm not super happy about, and that tend to bite 
me from time to time.

First, you need to "know" whether the variable you are dealing with is an 
interface or a struct. Structs can implement interfaces, of course, so in general you 
tend to treat these as the same thing. But when you're dealing with a struct, you 
might be passing by reference, in which the type is *myStruct, or you might be passing 
by value, in which the type is just myStruct. If, on the other hand, the thing you're 
dealing with is "just" an interface, you never have a pointer to it -- an 
interface is a pointer in some sense. It can get confusing when you're looking at code 
that is passing things around without the * to remember that it might actually 
"be a pointer" if it's an interface rather than a struct.

Go's type inference makes for lean code, but requires you to dig a little to figure 
out what the type of a given variable is if it's not explicit. So given code like:

    foo, bar := someFunc(baz) 

You'd really like to know what foo and bar actually are, in case you want to add some 
new code to operate on them. If I could get out of the 1970s and use an editor other 
than vi, maybe I would get some help from an IDE in this regard, but I staunchly 
refuse to edit code with any tool that requires using a mouse.

Finally, Go's liberal use of interfaces allows a struct to implement an interface 
"by accident". You never have to explicitly declare that a given struct 
implements a particular interface, although it's good coding style to mention this in 
the comments. The problem with this is that it can be difficult to tell when you are 
reading a given segment of code whether the developer intended for their struct to 
implement the interface that they appear to be projecting onto it. Also, if you want 
to refactor an interface, you have to go find all of its (undeclared) implementations 
more or less by hand.

Most of all I find coding in Go really, really fun. This is a bad thing, since we all 
know that "real" programming is supposed to be a grueling, painful exercise 
of fighting with the compiler and tools. So programming in Go is making me soft. One 
day I'll find myself in the octagon ring with a bunch of sweaty, muscular C++ 
programmers bare-knuckling it out to the death, and I just know they're going to mop 
the floor with me. That's OK, until then I'll just keep on cuddling my stuffed gopher 
and running gofmt to auto-intent my code.

まず、見出しに「Why not Go?」とあって、本文も最後の段落に 「Most of all I find coding in Go really, really fun. 」とあるのに、 なんで 「Goで苦労していることは、」 で片付けるかなー

ここの訳文もツッコミどころ満載なんだけどいい加減疲れたので止めます (といいつつ明日辺り蒸し返すかもしれない :)

■_

ついったから。 Zed の「Learn C the hard way」どうなるんだろうねえ…

■_

松江での某イベント。 Matz' Keynote

顕微鏡本(他にもありますが)、29日まで半額だそうですぜ。 Save 50% on Ruby Ebooks - Deals - O'Reilly Media For one week only, SAVE 50% on select Ruby ebooks and see why it's the language programmers love to write.

■_

■_

面白そう The Challenge of Cross-language Interoperability - ACM Queue


一つ前へ 2013年11月(中旬)
一つ後へ 2013年12月(上旬)

ホームへ


リンクはご自由にどうぞ

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