ときどきの雑記帖 2012

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

一つ前へ 2012年5月(中旬)
一つ後へ 2012年6月(上旬)

ホームへ

2012年05月31日

■_

今日の新言語 The Swift Parallel Scripting Language The Swift parallel scripting language. Fast easy parallel scripting - on multicores, clusters, clouds and supercomputers

そして5月が終わる…

■_

■_ PowerShell

いろいろとまあ

PS C:\Windows\system32> [datetime]::isleapyear


MemberType          : Method
OverloadDefinitions : {static bool IsLeapYear(int year)}
TypeNameOfValue     : System.Management.Automation.PSMethod
Value               : static bool IsLeapYear(int year)
Name                : IsLeapYear
IsInstance          : True



PS C:\Windows\system32> [datetime]::isleapyear(2000)
True
PS C:\Windows\system32> [datetime]::isleapyear(2001)
False
PS C:\Windows\system32> [datetime]::isleapyear(2004)
True
PS C:\Windows\system32> [datetime]::isleapyear(2100)
False
PS C:\Windows\system32> [datetime]::isleapyear(2400)
True
PS C:\Windows\system32> [datetime]::isleapyear(1600)
True

まだまだ色々隠れていそう

■_ vs

PL/I 対 C

Power vs. Adventure - PL/I and C

Power vs. Adventure - PL/I and C

This paper was presented at the G.U.I.D.E.&SHARE Europe Joint Conference (10-13 October 1994, Vienna, Austria).

Abstract

    The "old and honest" programming language PL/I seems to grow new blossoms; in OS/2
    -- and soon AIX -- PL/I offers capabilities comparable to C. This presentation shows the
    differences in philosophy of both languages: PL/I allows problem-oriented programming
    without knowledge of low-level constructs, whereas C requires, for example, pointer
    programming even when reading a file. You should consider using PL/I instead of C if you
    prefer a programming style where the compiler does the tedious work for you.

    PL/I は C とに比肩されるような capabilities を offer しています。
    このプレゼンでは、これら二つの言語の哲学の違いを明らかにします。
    PL/I  は、C では必要とされるような低レベル構造についての知識がなくても
    problem-oriented なプログラミングを可能としています。
    この低レベル構造はたとえば、ファイルを読み出すときにさえ現れるポインターです。
    もしあなたが、コンパイラーがあなたのためにたいていのことをやってくれるような
    プログラミングスタイルを望むのなら、C ではなく PL/I を使うことを考えるべきでしょう。


    The author is member of the scientific staff for application programming at the Computing
    Center of the University of Münster, Germany. 

Introduction

This presentation is biased -- neither accidentally nor intentionally but necessarily. The
reason is that programmers have their favorite programming language. Mine is PL/I but I studied
C because there is a widespread operating system called Unix which I had to write programs for.
Additionally I had many discussions with colleagues in my computing center comparing the two
languages. Of course, I will always refer to OS/2 PL/I and ANSI-C because they are the modern
versions!

このプレゼンにはバイアスがかかっています。
それは偶然によるものでも意識的にかけられたものでもありませんが必要なものです。
その理由は、プログラマーというものは自分の好きなプログラミング言語というものを
持っているからです。わたしの好きなプログラミング言語は PL/I なのですが、
C も学びました。それはわたしがプログラムを書かねばならなかった UNIX と呼ばれていて
広く使われていたオペレーティングシステムが存在していたからです。


First I want to present 5 theses: Too many things in C...

    are different from what they seem to be!
    are undefined!
    are poorly defined!
    cannot be checked by the compiler!
    are not checked by the compiler! 

(以下略)

■_

↑に対する reddit での反応

comparing PL/I with C (PL/I is better) : programming

I disagree with some of the commentary, and part of it is plain wrong. In general, it's C
viewed from the perspective of a PL/I programmer. It does highlight some widely acknowledged
warts in C. I look the other way and draw the opposite conclusions, and see warts in PL/I.

Here are my biggest objections.

"What do you think is the result of quotient in the following example:
quotient = nominator/pdenominator / ? */;"

The general rule is that tokens are identified greedily. Other than someone not used to the
'/*' syntax for comments (and PL/I uses the same syntax), I don't see how this would be a
confusion.

The "What Is an Array" section has a bug: "for (i = 1; i < 10; i += 1)"
should start from 0. Of course, later in that section it says "no human starts counting
from 0!". Perhaps the author does not think Dijkstra is human? In any case, it seems that
C has convinced a lot of people to start counting from 0.

The "What Is a String" confuses C's byte arrays with strings, and the commentary ignores
"strncpy" from C90. The section is worthless.

I don't understand the comment "Really strange is the treatment of bits as integers".
It makes perfect sense to me.

The example "Thus there is only one set of logical operators in PL/I whereas C has two:"
confuses the bitwise operator '&' with the short-circuiting logical operator '&&'.

PL/I has a "controlled" storage class, used to build a stack. How does it let you
specify which memory arena to use? Eg, how do I build a stack in a shared memory block?

I am curious to know which operators in C, that are not in PL/I, should by the author's
estimation, not be there.

Several of the problems (comments embedded in comments, unexpected upconversion, assignment
inside of an expression) are warts, and addressed these days through compiler warnings.

How does PL/I's error handling support multi-threaded programming? What it says is an 
advantage to PL/I, I see as being strange.


Really? An argument against indexing starting with 0? So this person doesn't even understand
what C was designed for? Sigh.


The author's argument was you should use a builtin which give you the base of the type. 
That lets you have an array for, say, the years "1970..2000" without having 
to do extra work. The author also prefers indexing over pointer arithmetic because 
then the compiler can optimize better.

That said, yes, the author doesn't understand what C was designed for.


Thank god that monstrosity is dead.

■_

RubySource | From Nothing to RubyRubySource

2012年05月30日

■_

さてどうしよう ASCII.jp:【速報】ウィルコムからキタ! PHS+3GのAndroid スマホ

なにやら面白そうな本が Twitter / rikoushonotana: 【書泉グランデ2

テキストもあるとうれしいんだけどなあ InfoQ: Ozma: Extending Scala with Oz Concurrency Summary Peter Van Roy discusses solving concurrency issues with deterministic concurrency using Ozma, an extension of the Scala language employing the Oz deterministic dataflow concepts.

↑のOz はガウディ本で使っていたあれですね。

■_

■_ +α

関数型プログラミング言語Haskell Part18

480 デフォルトの名無しさん [sage] 2012/05/30(水) 14:28:51.43 ID: Be:
    すごいHaskell
    たのしく学ぼう! ||
         人 _  |-|
         旦/○\日
         目 ァイリ |-|
      / ̄ ̄ ̄ ̄ ̄\  
      □-□ U      |
      | .|ι        |
    旦ノノ||  ̄ ̄ ||



    AAなんてあったのね 

481 デフォルトの名無しさん [sage] 2012/05/30(水) 15:27:23.39 ID: Be:
    >>480
    さっき本屋で見てきたんだけど、B5大型本を想像していたので文庫本+αのサイズが意外だった。電車の中でも読めるね。
    中身も読みやすく編集されているようで、これからHaskellやって見ようという人にはお勧めだと思う。

    ステマでした 

あの本てA5サイズですよねえ Amazon.co.jp: すごいHaskellたのしく学ぼう!: Miran Lipovaa, 田中 英行, 村主 崇行: 本 商品の寸法: 20.8 x 15 x 2.4 cm

本のサイズ(判型)と本の種類 - 印刷物の寸法・規格

A5判 	148×210 	学術書・文芸雑誌・総合雑誌・教科書など 	A列本判(32) 菊判(32)
B6判 	128×182 	単行本など
A6判 	105×148 	文庫本
  

+αというには差がありすぎな気が(面積で2倍)

■_ pbirthday

とあるラジオを聴いていたら、 9人の集団のうち、3人の誕生日が同じで「天文学的確率」 (いやまあ良くある誇張だろうけど)とかなんとかパーソナリティが言ってたんですが 実際のところどのくらいの確率なんだろうかというのが気になった。 これが二人なら簡単なんですが三人だとどうやるんだろうと悩んでいたら R におあつらえ向きの関数があるのを発見。


R version 2.15.0 (2012-03-30)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

Rは、自由なソフトウェアであり、「完全に無保証」です。 
一定の条件に従えば、自由にこれを再配布することができます。 
配布条件の詳細に関しては、'license()'あるいは'licence()'と入力してください。 

Rは多くの貢献者による共同プロジェクトです。 
詳しくは'contributors()'と入力してください。 
また、RやRのパッケージを出版物で引用する際の形式については 
'citation()'と入力してください。 

'demo()'と入力すればデモをみることができます。 
'help()'とすればオンラインヘルプが出ます。 
'help.start()'でHTMLブラウザによるヘルプがみられます。 
'q()'と入力すればRを終了します。 

 [以前にセーブされたワークスペースを復帰します] 

> pbirthday
function (n, classes = 365, coincident = 2) 
{
    k <- coincident
    c <- classes
    if (k < 2) 
        return(1)
    if (k == 2) 
        return(1 - prod((c:(c - n + 1))/rep(c, n)))
    if (k > n) 
        return(0)
    if (n > c * (k - 1)) 
        return(1)
    LHS <- n * exp(-n/(c * k))/(1 - n/(c * (k + 1)))^(1/k)
    lxx <- k * log(LHS) - (k - 1) * log(c) - lgamma(k + 1)
    -expm1(-exp(lxx))
}
<bytecode: 0x03673f1c>
<environment: namespace:stats>
> qbirthday
function (prob = 0.5, classes = 365, coincident = 2) 
{
    k <- coincident
    c <- classes
    p <- prob
    if (p <= 0) 
        return(1)
    if (p >= 1) 
        return(c * (k - 1) + 1)
    N <- exp(((k - 1) * log(c) + lgamma(k + 1) + log(-log1p(-p)))/k)
    N <- ceiling(N)
    if (pbirthday(N, c, k) < prob) {
        N <- N + 1
        while (pbirthday(N, c, k) < prob) N <- N + 1
    }
    else if (pbirthday(N - 1, c, k) >= prob) {
        N <- N - 1
        while (pbirthday(N - 1, c, k) >= prob) N <- N - 1
    }
    N
}
<bytecode: 0x036774e0>
<environment: namespace:stats>
> pbirthday(n=9, classes=365, coincident=3)
[1] 0.0008948968
> for (n in 3:40) {cat(n, pbirthday(n, classes=365, coincident=3),"\n")}
3 3.356938e-05 
4 7.940683e-05 
5 0.0001547676 
6 0.0002668752 
7 0.0004228863 
8 0.0006298884 
9 0.0008948968 
10 0.001224851 
11 0.001626611 
12 0.002106954 
13 0.002672566 
14 0.003330042 
15 0.004085877 
16 0.004946463 
17 0.005918077 
18 0.007006883 
19 0.00821892 
20 0.009560094 
21 0.01103618 
22 0.01265279 
23 0.01441541 
24 0.01632934 
25 0.01839973 
26 0.02063154 
27 0.02302956 
28 0.02559837 
29 0.02834237 
30 0.03126574 
31 0.03437244 
32 0.03766622 
33 0.04115057 
34 0.04482878 
35 0.04870387 
36 0.05277859 
37 0.05705547 
38 0.06153674 
39 0.06622436 
40 0.07112002 
> qbirthday(prob=0.25,coincident=3)
[1] 64
> 

ふむ。

が、ここではたと気がついた。 自分と同じ誕生日の人間が二人いる(合計三人)ということだと 答えは違うんではなかろうかと

誕生日のパラドックス - Wikipedia

一方、先ほどの、n人の部屋に"あなた"が入ったときに、あなたと同じ誕生日の人がいる確率 p3 は、

    p_3(n) = 1- \left( \frac{364}{365} \right)^n

となる。n = 23 ならば、p3 = 0.0611… である。n が 253 のときに初めて p3 が 0.5 以上となる。
  

よくわかんね。

■_ loop

新言語

loop - a programming language

loop

About Get Loop Documentation FAQ Mailing List

    loop is a little language for the jvm. it takes advanced functional features and makes
    them easy and fun to use!

    loop は JVM のための littele language で、先進的な関数的機能を簡単に楽しく使える
    ようにしています!

see for yourself
hello world →

    print('hi')

here I am "adding" a method to a simple java string
ここで単純な Java string にメソッドを追加します

greet(name) ->
  "hi, @{name}!"

'Zaphod Beeblebrox'.greet()

loop produces clear, useful stack traces when things go wrong

loop はなにか問題があったときには明確かつ有用なスタックトレースを生成します

java.lang.RuntimeException: i'm complaining
    at prelude.raise(prelude.loop:9)
    at myapp.func3(my_app.loop:3)
    at myapp.func2(my_app.loop:6)
    at myapp.func1(my_app.loop:9)
    at myapp.main(my_app.loop:13)

other fun stuff

    bullet arrowclosures
    bullet arrownull-safety
    bullet arrowjava interoperability
    bullet arrowbuilt-in concurrency
    bullet arrowpattern matching + guards

© 2012 by Dhanji R. Prasanna. Some rights reserved.

2012年05月29日

■_

買った
Borderland TVアニメ「ヨルムンガンド」OPテーマ<通常盤>
Borderland TVアニメ「ヨルムンガンド」OPテーマ<通常盤>

しかし、アレとかアレは買えなかったのであった。

■_ Python

こーゆーツイートを見かけたので Twitter / brainfs: 3要素のタプルのリ

試してみた

>>> r=[(1,2,3),(4,5,6),(7,8,9)]
>>> r
[(1, 2, 3), (4, 5, 6), (7, 8, 9)]
>>> [t[1] for t in r]
[2, 5, 8]
>>> zip(*r)[1]
(2, 5, 8)
>>> zip(*r)
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
>>> r
[(1, 2, 3), (4, 5, 6), (7, 8, 9)]
>>> r[1]
(4, 5, 6)
>>>

なるほど。

■_

2012年05月28日

■_

ブックオフ
日曜日にちょっと行ってみたんですが、 漫画のところの混雑ぶりがひどかった。立ち読みしている人ばっか。 新刊であんな感じになったらたまらんからシュリンクするんかねえ と思ったり思わなかったり。

ML名古屋まとめ - NAVER まとめ http://matome.naver.jp/odai/2133811176462614101

■_

Nick Bradbury: Old Farts Know How to Code So many developers my age have had plenty of chances to ditch coding and move into management, but we've stuck with coding because it's what we love to do. We'd earn more in management, but writing software is in our blood. We wouldn't stop doing it for anything.

時間があれば全訳するんだけど(って長くもないのにねえ○| ̄|_)

■_ QRegex

Rakudo でなにやら大きめの変更があった?

Rakudo switched over to QRegex | 6guts

Rakudo switched over to QRegex
Posted on May 28, 2012

In my last post – just two days ago – I talked about how the work to switch Rakudo over to
using QRegex for parsing Perl 6 source was going well. I guessed there was a 90% chance we'd
land it well in time for the next release, hoping it would happen sometime in the next week.

Well, after a flurry of fixes and testing, with contributions from moritz++, diakopter++ and
tadzik++, it landed today. We got to the point where the spectests showed up zero regressions,
which was a very encouraging sign. Then, tadzik++ did a run of Ementaler (automatic building
and testing of all the modules) to see how module ecosystem had fared the transition. That
caught one issue, which was easily fixed. After that…no regressions there either. And not
only did we not regress on any spectests, but the improved LTM meant some previously failing
spectests are now passing also.

So, it's merged. NQP is now bootstrapped using a regex implementation written in itself,
Rakudo now uses QRegex for parsing, and the next release will ship with it. And there's still
a good three weeks to go until the next release to tune it – and, of course, for plenty more
general Rakudo development.

そして QRegex はマージされました。NQP は自分自身で記述された正規表現実装をつかって
ブートストラップされます。Rakudo はパージングのために QRegexを使うようになり、
次のリリースでは本体と一緒にship されるでしょう。

■_

InfoQ。どう訳されるかなあ

InfoQ: Crossing the Software Education Chasm

Crossing the Software Education Chasm

In their recent blog posting “Crossing the Software Education Chasm” for the Communications
of the ACM Armando Fox and David Patterson  from UC Berkeley address the tradeoff between
university education of software engineers and actual expectations of employers. They suggest
that a solution to reduce this gap consists of teaching students agile development of SaaS
apps using tools like rails.

Software engineering and software architecture education at universities is often considered
inappropriate by companies, because students do not learn how to deal with the whole software
development lifecycle. Rather they only get to know parts but not the whole.  Fox and Anderson
claim that agile development with SaaS apps could be an an appropriate approach for classrooms
because these tools help students to experience a whole software development lifecycle.  Apps
are supposedly the right means:

(以下略)

■_

高速なビットマップ処理

Fast bitmap decoding

Fast bitmap decoding

An old programming trick is to represent sets of integers as bitmaps. For example, the 
sequence of integers 1, 4, 6 becomes the number 0b1010010 in binary (or 82 in decimal). 
Bitmaps are efficient data structures.

で、プログラム片が三つ。

  for(int k = 0; k < array.length;++k) {
      bitmap[array[k]/64] |= 1l << (array[k]%64);
  }

  for(int k = 0; k<bitmap.length; ++k) {
      for(int c = 0; c<64; ++c) {
          if (((1l << c) & bitmap[k]) != 0) {
              ans[counter++] = k*64+c;
          }
      }
  }

  for(int k = 0; k<bitmap.length; ++k) {
      long v = bitmap[k];
      while(v!=0) {
          int ntz = Long.numberOfTrailingZeros(v);
          v^=(1l<<ntz);
          ans[counter++] = ntz +k * 64;
      }
  }

元記事ではグラフを使った性能比較をしています。


Conclusion: Fast functions to compute trailing zeros are your friends when working with bitmaps.

© 2004-2012, Daniel Lemire (lemire at gmail dot com).
This work is licensed under a Creative Commons License.

■_

c

2012年05月27日

■_

来週のNHKスペシャルは観よう(録画してあとからだけど) NHKスペシャル|コンピューター革命最強×最速の頭脳誕生

If Money Doesn't Make You Happy, Consider Time | Stanford Graduate School of Business

書くことはあるのだけど時間ががががが

■_ 和んだ

某スレより。

くだすれFORTRAN(超初心者用)その5 

898 デフォルトの名無しさん [] 2012/05/24(木) 15:33:29.05 ID: Be:
    見つからないバグがあります。

    do i = 1, N
    call sub(XXX,YYY)
    enddo

    のようなループでサブルーチンを呼び出しています。
    XXXは構造体で、intent(out)属性をつけています。
    YYYも構造体で、intent(in)です。
    YYYを読み込んで、XXXを吐きだすサブルーチンです。
    最初、XXXはゼロで、サブルーチンから出力されると値が入ります。
    それで、二回目のループに入るんですが、
    そうすると、出力されるXXXがゼロになってしまいます。
    なぜこのようになるのか、わかりません。
    教えてください。よろしくお願いします。 

899 デフォルトの名無しさん [sage] 2012/05/24(木) 15:51:19.34 ID: Be:
    XXX がintent(out) でコンパイルが通ったということは、
    YYY の値が変更されない限り
    XXX は何度目の n でも同じ値になりそう・・。
    なんか根本的にコードの構造を間違ってない?

    自分なら
    YYY の値が狂った、
    引数に出てこない module common 渡しの変数が狂った
    可能性を取り敢えず、疑って見るが。 

900 デフォルトの名無しさん [sage] 2012/05/24(木) 15:58:01.96 ID: Be:
    >>890
    >coArrayが実装されたようだから

    CoArray 使った事ある人いたら
    OpenMP MPI との比較とか
    パフォーマンスとか、
    感想聞かせて

901 デフォルトの名無しさん [sage] 2012/05/24(木) 22:55:04.67 ID: Be:
    intent(out) でいいんだな? intent(in out)のつもりじゃないよな。

    サブルーチンはPUREなのか?それともSAVE的なものがあるのか?
    PUREならYYYにしか依存しないから、YYYを確かめるべし。
    そうでなくて、状態依存、ヒステリシスを持つルーチンならそれ絡みの変数をみるしかない。 

902 デフォルトの名無しさん [] 2012/05/25(金) 03:16:23.21 ID: Be:
    >>899>>901
    他の場所の単純なバグでした
    失礼しました。 

903 デフォルトの名無しさん [] 2012/05/25(金) 09:30:28.37 ID: Be:
    www
    また来いよ 

■_ 「点で」違う

その2

Perlについての質問箱 52箱目

178 デフォルトの名無しさん [] 2012/05/25(金) 22:24:45.20 ID: Be:
    decodeとencodeの違い、使い分け方を教えて下さい 

179 デフォルトの名無しさん [sage] 2012/05/25(金) 22:27:17.00 ID: Be:
    >>178
    decode:文字列を内部形式に変換
    encode:内部形式の文字列をいろんなエンコードに変換 

180 デフォルトの名無しさん [sage] 2012/05/25(金) 23:56:31.64 ID: Be:
    デcode は点々がつくのでフラグが点く。
    エンcode は点々が点かないのでフラグが落ちる。
    煩わしい場合は全部フラグなしで通しても構わない。
    その場合はencode、decodeの使い分け方に悩まずに済む。 

なるほどこういう覚え方もあるのかw

■_ スケールアウト

ちと気になったので調べてみた。 scaleの意味 - 英和辞典 Weblio辞書 scaleoutの意味 - 英和辞典 Weblio辞書

Scalability - Wikipedia, the free encyclopedia

Scale horizontally vs. vertically

Methods of adding more resources for a particular application fall into two broad 
categories:[3]

Scale horizontally (scale out)

To scale horizontally (or scale out) means to add more nodes to a system, such as adding a new
computer to a distributed software application. An example might be scaling out from one Web
server system to three.

As computer prices drop and performance continues to increase, low cost "commodity" systems
can be used for high performance computing applications such as seismic analysis and
biotechnology workloads that could in the past only be handled by supercomputers. Hundreds of
small computers may be configured in a cluster to obtain aggregate computing power that often
exceeds that of single traditional RISC processor based scientific computers. This model has
further been fueled by the availability of high performance interconnects such as Myrinet and
InfiniBand technologies. It has also led to demand for features such as remote maintenance and 
batch processing management previously not available for "commodity" systems.

The scale-out model has created an increased demand for shared data storage with very high I/O
performance, especially where processing of large amounts of data is required, such as in
seismic analysis. This has fueled the development of new storage technologies such as object
storage devices.

Scale out solutions for database servers generally seek to move toward a shared nothing
architecture going down the path blazed by Google of sharding.

Scale vertically (scale up)

To scale vertically (or scale up) means to add resources to a single node in a system,
typically involving the addition of CPUs or memory to a single computer. Such vertical scaling
of existing systems also enables them to use virtualization technology more effectively, as it
provides more resources for the hosted set of operating system and application modules to share.

Taking advantage of such resources can also be called "scaling up", such as expanding
the number of Apache daemon processes currently running.

なるほど水平と垂直。

■_

R のチュートリアル。 短時間の映像で項目ごとに説明してくれるっぽい

r twotorials

    001 how to download and install r
    002 simple shortcuts for the windows r console
    003 how to do simple arithmetic in r
    004 how to create a variable with r
    005 how to use the c (combine) function
(略)
    085 how to export or save a plot in r
    086 fun one: what is each country's most current available percent of gross national income spent on education?
    087 how to split a character string in r with the strsplit function
    088 how to change options and global settings like the number of decimal places shown in r with the options function
    089 how to run a block of commands at start-up to do stuff like setting your CRAN mirror permanently with r
    090 fun one: how to calculate your ten, fifteen, or twenty thousandth day on earth with r

■_ 三つの鍵

3 Key Software Principles You Must Understand | Nettuts+

3 Key Software Principles You Must Understand
Chris Peters on May 23rd 2012

If you're in software development, new techniques, languages and concepts pop up all of the time.
We all feel those nagging doubts every now and then: “can I keep up with the changes and stay
competitive?” Take a moment, and sum a line from my favourite movie, Casablanca: “The
fundamental things apply, as time goes by.”

    What's true for love, is true for code.

What's true for love, is true for code. The fundamental things will always apply. If you have
an understanding of the underlying ideas of software development, you will quickly adjust to
new techniques. In this tutorial, we will discuss three basic principles and mix them with many
more. They provide a powerful way of managing the complexity of software. I'll share some of my
personal opinions and thoughts, which, hopefully, will prove useful when it comes to applying
them to code and real-world projects.

Principle – Don't Repeat Yourself


    A basic strategy for reducing complexity to managable units is to divide a system into pieces.

(略)

Principle – Keep it Simple Stupid

    The simplest explanation tends to be the right one.

(略)

Principle – You “Ain't Gonna Need It

    Coding is about building things.

以下略

■_

2012年05月26日

■_

数学セミナー
やっと読んだ。いろいろな言語の数詞の話(でいいんだろうか)が面白かった。

東京堂書店
改装完了しててカフェつきになってた。

アルゴリズムを学ぼう
まだなかった。
アルゴリズムを学ぼう
アルゴリズムを学ぼう

■_ redditに訊け

言語設計者が最低限Lispについて知っておくべきこと。 といった感じ?

What's the absolute minimum a language designer should know about Lisp? [StackOverflow] : lisp

It got deleted real quick, but I have enough rep on StackOverflow to see deleted 
questions and answers.

    I'm trying to describe how Lisp's metaprogramming facilities have influenced the design
    of later programming languages.

    I'm wondering which terms should be introduced to people interested in language design
    as an absolute minimum to enable further discussion and debate.

    Is there some definitive vocabulary everyone should know? I'm thinking about covering at
    least namespaces, hygiene and quotations.

I suggest starting at the C2 wiki,

    http://c2.com/cgi/wiki?CommonLisp
    http://c2.com/cgi/wiki?SchemeLanguage

And reading things by Paul Graham,

    http://paulgraham.com/arc.html

And for an example of an "I told you so" from Lisp, see this question:

    http://stackoverflow.com/questions/8898925/is-there-a-reason-for-cs-reuse-of-the-variable-in-a-foreach

Summary: In C#, it used to be that loop variables were reused across the entire loop, which
meant that closures created inside the loop would see a loop variable with the most recent value,
instead of the value that the closure was created with. This is VERY surprising. The C# people
fixed it almost 10 years later, but if they had been big fans of Scheme this never would have
happened. JavaScript is getting something similar with the let keyword.

C# ではループ変数はループ全体にわたり再利用されていて、
(C# の)ループの内側で生成されたループ変数を抱えたクロージャは
そのループ変数の作られた時点の値ではなく直近の値が見えるようになっていました。
これは「非常に」驚くべきことです。
C# 開発者たちがこれを修正したのは十年もあとのことでした。
彼らが Scheme の big fans であったならこんなことが起きることはなかったでしょう。
JavaScript は let というキーワードで同じようなことをしています。

When the Scheme folks talk about "lexical scoping" as if it's a big deal, 
remember that it is a big deal.


Hah, I got bitten by the Loop Variable odd capturing behaviour in Javascript just yesterday.
Coming from a Scheme background I found it pretty confusing, indeed!


Thanks a lot!


You may also be interested in ReadScheme, which is a great repository of knowledge 
about language design in Scheme. For metaprogramming, see the sections on macros and 
reflection.

readscheme はこちら → Readscheme.org - Functional Programming Resources

■_ Looking for compilers written in Common Lisp for non-Lisp languages

Common Lisp で書いた(Lisp以外の言語の)コンパイラー。

Looking for compilers written in Common Lisp for non-Lisp languages : lisp

Looking for compilers written in Common Lisp for non-Lisp languages (self.lisp)


Hello,

Are there any open source compilers out there that are written in Common Lisp for a non-Lisp
language? I'm interested in seeing how that might be done. Ideally, it would be nice if the
targeted language were something like C.

This seems like something that would exist, but maybe I'm just using the wrong search terms
to find it.

Thanks for any info, Mick


There are a lot of languages that are implemented in Common Lisp.

Now, unfortunately, it's often only the early implementation of a language that is written in Lisp.

cl-python http://common-lisp.net/project/clpython/

There's a r4rs scheme implementation named Pseudo. http://www.cliki.net/PseudoScheme

An early implementation of Yale Haskell. http://www.cliki.net/Yale%20Haskell

"In ~2003, Mozilla's CVS tree still contains the original implementation of Javascript...
written in Common Lisp." Well, the mozilla/js2/semantics/README that I just checked-out
from mozilla CVS says:

js/semantics contains experimental code used to generate LR(1) and LALR(1)
grammars for JavaScript as well as compile and check formal semantics for
JavaScript.  The semantics can be executed directly or printed into either
HTML or Microsoft Word RTF formats.

You may also be interested in Zeta-C although it's not written in Common Lisp http://www.cliki.net/Zeta-C.

maxima (which implements a mathematical language similar to macsyma, ie. similar to mathematica,
octave or mathlab). http://maxima.sourceforge.net/

acl2 (which is a theorem prover) implements a lisp-like language in CL.
http://www.cs.utexas.edu/~moore/acl2/

Qi is implemented in Common Lisp. http://en.wikipedia.org/wiki/Qi_%28programming_language%29

Here is a toy implementation of BASIC in CL:
http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/basic/

And the implementation L.S.E (Langage Symbolique d'Enseignement, a French programming
language of the 70's):
http://nasium-lse.ogamita.com/
http://fossil.nasium-lse.ogamita.com/nasium-lse/dir?ci=tip

And a few more, see http://www.cliki.net/programming%20language


There is also Vacietis, a C->CL compiler inspired by Zeta-C. It's not finished but does
have some basic functionality and may prove interesting as is.


You mean like these? http://www.cliki.net/programming%20language


CL-Javascript seems impressive, I have been planning to use it for scripting purposes myself.

It's too bad that a lot of these projects are dead since having an option to use a 
more mainstream language for scripting CL applications is often desirable and is 
something CL could be very good at.

Although it isn't Common Lisp, there's Zeta C, which is written in ZetaLisp (precursor 
to Common Lisp) and is a C compiler. As Cliki notes, it isn't trivially portable to CL, 
but it should be indicative of the general style you would use.

e: woops, didn't see that this was mentioned above.


Initial versions of the Yale Haskell Compiler have been written in Common Lisp, see here.


Axiom (axiom-developer.org) is a computer algebra system implemented in Common Lisp. 
It has a langage called Spad for the algebra. The Spad compiler is all in Lisp.


hi,

you are looking for this:

http://voodoo-slide.blogspot.com/2010/01/amplifying-c.html

the guy uses Common Lisp to generate C that is still readable. think of it as a 10x more powerful C toolchain.

i'm toying with building something similar in my spare time.

■_

2012年05月25日

■_

天地明察
アフタヌーンの連載を楽しみにして読んでいるので小説とか映画とかどうしたものかと悩みんぐ。

読書会参加者募集ちう。

いい本らしいんですが、ちとお高い(が、オンデマンド版を買えば5000円前後で 買えた筈なんだけどどこだったかなああ売ってるの)。 Amazon.co.jp: Algebra of Programming (Prentice-Hall International Series in Computer Science): Richard Bird, Oege De Moor: 洋書

(原著買ってたのに)放置してたらこのザマだよっw

■_ 'D' is

D is a dragon, or why D matters for Bioinformatics : programming

D is a dragon, or why D matters for Bioinformatics (blog.thebird.nl)


How is D much safer than modern C++?


The fundamental non-safety comes from pointer arithmetic. When adding or subtracting from a
pointer, there is no way to statically determine if the data pointed to by the changed pointer
is valid. Hence all the vulnerabilities with buffer overflows, etc.

D's solution is to have ranged pointers (called "slices" in D). Slices come as a pair,
a pointer to the start of the object, and a size of that object. Adjustments to the pointer
can then be done at runtime, and so can be guaranteed memory safe.

(You can still do raw pointer manipulation in D if you so desire.)

Automatic memory management (garbage collection) eliminates memory corruption problems 
resulting from freeing invalid pointers and freeing a pointer more than once.

Functions in D can be marked as @safe, which will statically guarantee that no 
constructs are used that could result in memory corruption. Pointer arithmetic, for 
example, is disallowed in such functions.


Good explanation, thanks.

    D's solution is to have ranged pointers

I think in C++ you would normally use STL containers and iterators instead of just plain
pointer array data. Iterator itself could be range checked (or not). I don't see much sense in
range checked pointer.

    garbage collection

It kills performance. Of course, the article pointed out that you don't have to use it 
in D, so maybe that's not really a problem. In C++ you can use smart pointer, like 
reference counted shared_ptr, companied with weak_ptr or simpler unique_ptr, which are 
totally safe, if used correctly.

Note that I'm not C++ expert, I just happen to like the language, and I know almost 
nothing about D. So my points could as well be garbage (which C++ won't collect).


    Iterator itself could be range checked (or not). I don't see much sense in range checked pointer.

D's ranges are not just range checked iterators. An input range in D is a type with properties
front and empty and a method popFront. It's functionality is closer to that of a pair of c++
iterators. You could define a D range on top of a pair of c++ like iterators like this:

struct Range(Iterator)
{
    Iterator start;
    Iterator end;
    @property auto front(){ return *start; } 
    @property auto empty(){ return start == end; }
    void popFront(){ start++; }
}

Functions that would need to take two iterators in C++ can only take one range in D. This makes
for much nicer code. Because one instance of a range is needed to represent a sequence, it is
practical for functions to return ranges, so you can do stuff like:

recurrence!((a, n) => a[n - 1] + a[n - 2])(0, 1)
    .take(10).reduce!((a, b) => a + b)(); //computes the sum of first 10 fibonacci numbers

Of course ranges could be implemented in C++ as well, but they fit really nicely with D's built
in array slices (which are ranges themselves) and the D standard library is built on top of
them, so it's very convenient to use them in D. To learn more about ranges
 see http://ddili.org/ders/d.en/ranges.html.

■_

D → ドラゴン、Ruby → ポニー、Scala → サラブレッドとはなんの比喩か

Pjotr's Blog › D is a dragon, or why D matters for Bioinformatics

D is a dragon, or why D matters for Bioinformatics

Ruby is a pony. Everyone loves a pony. Ruby is nice.

Scala is a thoroughbred. You know I like Scala – it is beautiful, and runs circles 
around the pony

D is a dragon. Very powerful, and somewhat unpredictable

The programming languages Ruby, Python, R and Perl have proven to be very popular in 
bioinformatics. These languages are interpreted and dynamically typed computer languages. They
are all great at parsing and handling genomic information. Results are quick to get, and the
development cycle may be gratifying. However, as the language shootout shows, they are also
rather slow, and hard to parallelize. It is not easy to get them to use those multi-cores
everyone has.

Ruby、Python、R、Perl といったプログラミング言語は bioimfomatics においてとても
ポピュラーなものです。これらの言語はインタープリター型であり動的に型付けされてる
コンピューター言語で、genomic information の解析や処理にとても役に立つものです。
結果をすぐに得られ、それにより開発サイクルが満足いくものになるかもしれません。
しかしながら、言語の性質としてとても遅いものであるし、同時に並行処理が困難でもあります。
マルチコアを活用するのはこれらの言語では容易なことではありません。


Some newer languages, such as Scala and D, are not only strongly typed, which has a real impact
on performance, but are also very good at automatically handling types. This means that coding
Scala or D, feels similar to coding dynamically typed languages. Also, Scala and D are OOP
languages that marry the functional programming paradigm. In practise, that means that we get
OOP goodness (and badness), with constructs that make it safer and easier to parallelize code.

Scala や D のような一部の新しい言語は強力に型付けされるものであるだけでなく
(このことは性能に影響を及ぼします)、型の自動的な扱いが良くできています。
このことは Scala や D でのコーディングが動的型付け言語でのコーディングと
同様の感触を与えることを意味します。
また、Scala と D は関数型プログラミングパラダイムと融合された
オブジェクト指向言語でもあります。
In practise, that means that we get OOP goodness (and badness),
with constructs that make it safer and easier to parallelize code.

略

Why is D a dragon? D's language is amazingly powerful, but not as carefully designed as Scala's.
Scala's design is as powerful, and simply beautiful. D feels more clunky and can get in the way
sometimes. I find its functional language implementation less intuitive than that of Scala.
Still, it works rather well, and it even has tail end recursion optimization (unlike the JVM).
What clinched it for me is that, next to raw runtime speed, there are three areas D beats Scala.
First, the D compiler itself is blazingly fast. Second, the D template system (generics) is
simpler and easier to understand. Even in my earlier blog examples have trouble with Scala's
advanced templating, which is not a good sign. Third, D code generation, or compile time
evaluation, rocks. Another thing to look into, there are many examples in the D standard
library. In the Beginning Scala book by David Pollack he gives an example of a computer game
that featured in _Why the lucky stiff‘s world (for Ruby insiders). What was enlightening to me
was the code repetition in David's book, necessary to build the players. That would not be
necessary in D's compile time evaluation. There are a few things I miss in D. For example
pattern recognition on unpacking data, which is great in Haskell, Erlang, and Scala (see
example). D has something for actors, so it may come to the main language. The second thing I
miss is that language elements do not always return values. I use that in Ruby all over the
place, because it makes for shorter code.

なぜ D がドラゴンなのか? D は信じられないほど強力な言語ではありますが、Scala ほどには
注意深く設計されたものではありません。
Sscla の設計は強力であると同時に単純で美しいものなのです。
D feels more clunky and can get in the way sometimes.
わたしは D の functional language implementation が Scala のそれよりも less intuitive
であると考えていますが、それでも D はよくできていて、
JVM とは異なり末尾再帰の最適化さえ備えているのです。
What clinched it for me is that, next to raw runtime speed,
there are three areas D beats Scala.
第一に、D のコンパイラー自身がても高速であること。
第二に、D のテンプレートシステム (ジェネリック) は単純で理解が容易であること。
Even in my earlier blog examples have trouble with Scala's advanced templating,
which is not a good sign.
第三に、D のコード生成やコンパイル時評価が素晴らしいということです。


Finally some things that keep cropping up when I bring up D. First, the licensing issues. D,
for historical reasons was closed source. That is changing now, with D2 compilers getting part
of Fedora and Debian to follow. Second the schism and negativism of D1 users caused by an the
move to D2. That you'll find on the Internet. D2 is not compatible with D1, and that has caused
grief. D2 was reinvented as the language designers progressed their ideas. If you want to read
more about the excellent D2 language I strongly recommend Andrei's book. It is a classic in its
own right, describing a next generation programming language. Even if you never get to
appreciate the power of the D language itself.

This was written by pjotrp. Posted on Friday, January 13, 2012, at 4:57 pm.

■_ Learn Lua the Hard Way

このタイトルからして Zed が書いたのかと思ったら別人でした。 Learn Lua the Hard Way | Hacker News Twitter / @zedshaw: Just learned that someone ...

Learn Lua the Hard Way | Sanity Phailed.me

Sanity Phailed.me
Learn Lua the Hard Way

This series more or less mirrors the series of the same name for Python. It's in my belief
that the only way to learn the in and outs of a language is to learn by practice, and by
that virtue, to practice as often as possible until you get the hang of the language.

で、そのコメント欄。

    Zeljko Dakic
    It is really nice tutorial, it helps understanding Lua better, however, I think you
    should pick different name, Zed Shaw has pretty much created his brand and this looks
    to me like you would like to piggy-back on good will he created. Anyhow, I would just
    name it differently, it can be Learn Lua the Right Way if you like this expression.

    Phailure, Life haz phailed me... once again.

    Hey, thanks for bringing that up. I originally started off with Shaw's python tutorial and
    that was such an eye-opener that I decided to write something similar for Lua in his honor.
    I never realized that he began a Learn x the Hard Way series soon after I began.
    Unfortunately, college and life caught up with me soon afterwards and I haven't really had
    the time or motivation to update the series. I'll try to come up with another name for this
    series so Shaw can have the namesake back.

© 2011 by Lee Gao.

■_

2012年05月24日

■_

あとで読むタブが減らねえ(減ったけどそれ以上に増えた)…

■_ 10 Software Tools You Should Know

知っておくべき十個のソフトウェアツール。

10 Software Tools You Should Know

10 Software Tools You Should Know

Posted by Jason Sachs on May 20 2012

Unless you're designing small analog electronic circuits, it's pretty hard these days to get
things done in embedded systems design without the help of computers. I thought I'd share a
list of software tools that help me get my job done. Most of these are free or inexpensive.
Most of them are also for working with software. If you never have to design, read, or edit
any software, then you're one of a few people that won't benefit from reading this. 

小さなアナログ電気回路を設計するのでない限り、今日においてコンピューターの助けを借りずに
組み込みシステムをきちんと設計することはとても困難なことになっています。
自分が仕事をしたときに助けになったソフトウェアツールのリストを共有しようと
わたしは考えました。そのようなツールの大半は無料であるか、そうでなくとも安価なものです。
また、ソフトウェアに対しても使えるものが大部分です。
もしあなたがソフトウェアの設計をしたことがなかったり、読んだことも編集したこともないのなら
この記事を読んでも得るとところはないでしょう。

Disclaimer: the "best" software tools are usually a matter of opinion. You may not
agree with my opinion, so just take it for what it's worth.

お断り
「最良の」ソフトウェアツールとは a matter of opinion (意見の肝?) であることが通常です。
あなたはわたしの意見に賛成できないかもしれないので、

1. Revision control systems -- whether you work in a team of 100, or you're just by yourself,
   if you're working on a design, you should be using revision control software. 

   バージョンコントロールシステム

(略)

2. File comparison tools -- Whether you're merging source code into a revision control system,
or you're just trying to see what the difference is between one file and another, you'll need
file comparison software.

   ファイル比較ツール

(略)

3. Editors -- working with text files can be easy or difficult depending on the software you're using. The heavyweight editors are the integrated development 

   エディター

(略)

4. Build tools -- if you're starting to write software in an IDE, you can just click "Build"
and the program will compile your source code for you.

   ビルドツール

(略)


5. Scripting tools -- Sometimes you need to put together a quick piece of software to do something.

(略)

6. Numerical analysis tools -- Unless you are doing something really simple like an 
internet-enabled traffic light, chances are you're doing some kind of math in an embedded
system project.

(略)

My last word on numerical analysis tools is a plea and a short rant:

Don't use Excel for numerical analysis!

(略)


7. Documentation utilities -- often you will need to communicate your ideas to others, and
there are many different types of software to help do this.

   ドキュメント作成用ユーティリティ

(略)

8. Terminal and communications software: When you need to communicate over serial ports, it's
time to use terminal software.

   ターミナルソフトおよび通信ソフト

(略)

9. Software quality assurance (QA) tools: If you write software and you think you write
bug-free software, you are fooling yourself.

   ソフトウェアの品質保証用ツール


(略)

10. Basic command-line utilities
    基本的なコマンドラインユーティリティ

Many of the following programs are UNIX command-line utilities from the days when there were no
graphical user interfaces, and things had to be done by hand. Unless there's some revolutionary
improvement in GUIs, there will always be a lot more you can do through the command-line, just
because there are more combinations of things you can do via scripts. If you're running OSX or
Linux, you already have these; if you're running Windows you can download binary versions that
will run on your OS at http://unxutils.sourceforge.net/ or http://sourceforge.net/projects/unxutils/

    less -- this is probably the one I use most; it lets you display the contents of a file
            page by page. You can also search for text content, or if you are viewing a log file
            that is being updated continuously, you can type F and it will continuously show you
            the latest lines being appended.

    grep -- lets you search a group of files for a regular expression.

    touch -- This updates the latest-modified-time of a file to the current date/time, or if a
             file does not exist, it creates an empty file.

    tee -- piping a command through tee (e.g. someprog | tee logfile) lets you copy the output
           of that command to a file while also printing the output to the terminal.

    which -- If you run a program foo.exe at the terminal and you want to know where that
             program is located, just type which foo.exe

    head and tail -- These let you print the first or last N lines of a file.

    uniq -- filters output to remove identical successive lines.

    du -- prints disk usage (total space taken) of a directory.

    wc -- counts lines, words, and characters of a file. (I use it when writing a Letter to the
          Editor so I can keep my word count under the maximum a newspaper allows.)

    cp, rm, mv, ls, cat -- these all have DOS equivalents (copy, delete, rename, dir, type),
          but the UNIX equivalents are sometimes expected by scripts so I have these installed
          in my path.

    md5sum -- useful for verifying file integrity by calculating the MD5 hash of a file.

    gzip and gunzip -- these compress and uncompress individual files; the .gz format is less
         common than .zip but you will find it occasionally, especially in webpages that are
         transmitted in compressed form.

    wget and curl -- these are programs that allow you to download web pages via HTTP outside
         your browser, for example if you want to download a known webpage directly to a file,
         or "screen-scrape" the contents of a page. They aren't standard UNIX
         programs; wget is from the GNU project, and curl is its own special thing. I like curl 
         better in most cases as it lets you do more.


Well, that's all for this list. It was difficult paring down my list to 10; a few other
programs like 7zip, CPU-Z, and System Explorer would have made the cut, but I wanted to stick
to a list of ten.

Happy computing!


■_

■_

賞味期限の切れたネタ候補がたくさん…

2012年05月23日

■_

買った。とりあえず紙の方を。 すごいHaskellたのしく学ぼう! | オーム社eStore(β)

昼の、自分のTLの状態を調べたいんだけど自宅のPC繋げっぱなしにしとくというのもアレだし 持ち歩いてる携帯端末では必要な情報を記録できないのでさてどうしよう

■_ 問題

CASL だとローテート命令はないんだっけ? 元データを論理右シフト → 左ローテート(with carry) で必要なビットをとるとか。 簡単には表引きかなあ。 大きさも考えて8ビットくらいで。

casl2の問題がわからないので教えてください。 | OKWave

casl2の問題がわからないので教えてください。

任意の16bitの数値について、bitの並び方を上下反転させた任意の番地に格納する。
 例えば 41CEh=0100 0001 1100 1110b → 0111 0011 1000 0010b=7382h

投稿日時 - 2012-05-21 14:23:18

■_

■_

もういろいろとアレで

2012年05月22日

■_

翻訳者の一人が、ついったで今日が発売だと言ってたんですが 池袋のジュンク堂や書泉ブックタワーくらいにしか入ってないらしく買えず。 → すごいHaskellたのしく学ぼう! | オーム社eStore(β)

原著買ってたのにほとんど読み進められなかったw

すごいHaskellたのしく学ぼう!
すごいHaskellたのしく学ぼう!

Learn You a Haskell for Great Good!: A Beginner's Guide
Learn You a Haskell for Great Good!: A Beginner's Guide

■_

Zed が(つくったものが)また話題に

Zedshaw/Tir | Hacker News

I'm really excited about async programming in what Zed dubs the "natural 
style": using coroutines to suspend and resume processing at points where input 
is needed.

Can this eliminate the callback hell that plagues the explicitly async frameworks 
(node.js, jquery, twisted, etc)?

But what about the downside? Now your handler is stateful and the language runtime is 
taking care of suspend / resume of the handler code. Can you migrate the suspended 
coroutine to another process, possibly on another machine? Or do you just take care to 
use sticky load balancing for all your stateful routes?

HN does something similar right? My understanding is that the fnid=... query param 
identifies a closure that's serving up a pagination of stories, and the "Unknown 
or expired link" error message happens when your own personal closure gets 
garbage collected by Arc.

In both the coroutine and closure cases, you've got something on the server side 
that's consuming resources even when there are no requests. This seems like a problem 
for scaling.

zedshaw

Scaling isn't so much the problem, since you can do various things to keep users on 
specific servers. In my setup, I also solve a lot of the state issues since there 
isn't a single state for the entire app, but instead for each process that runs a 
small part of the app. That means you can scale and change up the application easier 
if you need without impacting the other parts.

The real problem with coroutines for storing state is simply that upgrading the code 
requires you to either kill all the old state, or trickle users off on A/B paired 
processes. Because the state is tied to the code, you can't just change the code and 
hope it works. Everything will be off and the coroutines won't continue.

Since Tir uses tiny processes, it's easier to do these upgrades in one part without 
killing the other parts, and since users are never in any one process for very long by 
design the risk is smaller.

But, you definitely have to be more careful than the other models.

zedshaw/Tir

■_

Try-Catch 構文について

Whiley | Variable Scoping for Try-Catch Blocks in Whiley


Variable Scoping for Try-Catch Blocks in Whiley
By Dave, on May 22nd, 2012

A friend of mine was talking about how variable scoping for try-catch blocks in Java 
really frustrated him sometimes.  Specifically, the problem was related to variables 
declared inside try blocks not being visible in their catch handlers. The example 
would go something like this:

	int val;
	try {
	 int tmp = f(); // cannot throw MyException
	 val = g(tmp); // throws MyException
	} catch(MyException e) {
	 log(tmp);
	 throw e;
	}
	return h(val);

This code does not compile because tmp is not in scope inside the catch handler. Of 
course, we can declare tmp outside the catch handler — but this is mildly annoying 
because it's only used within that block!

Anyhow, during the discussion I realised that Whiley doesn't have this problem 
because it uses flow typing. In fact, there is no real notion of scoping for local 
variables. The rule is fairly simple: if the variable definitely has a value then it'
s in scope. The above example would then look like this in Whiley:

	try:
	   tmp = f() // cannot throw MyException
	   var = g(tmp) // throws MyException
	catch(MyException e):
	   log(tmp)
	   throw e
	// var is in scope
	return h(var)

Here, the flow typing system will reason that there is no control-flow branch within 
the block until after tmp is assigned. Therefore, tmp can be safely used within the 
catch handler.

Ok, so this particular aspect of flow typing is hardly going to set the world on fire 
… but I thought it was quite neat!

■_

■_

「あとで読む(読み直す)」のグループにあるタブが200個に届こうとしている… Too Many Tabs というアドオンで管理させているのが大半なので ブラウザーはそれほど重くはなっていないのだけど。

2012年05月21日

■_

金環蝕 見ました。ばっちりと。 家を出る時間にはこりゃあだめかなあというくらいの曇り具合だったのですが 蝕が最大になる辺りではちょうど雲が薄くなっているとことにかかって 見ることができたと。 あ、ちゃんと専用グラスは用意しました:)

LL Decade のチケット購入。

中華料理うまかった。

■_ Quotes

いろいろなプログラミング言語に冠する格言(のようなもの)

全部訳そうと思ったけどなんか訳しにくい言い回しががががが

Quotes about programming languages

Quotes about programming languages

What computer scientists, authors and programmers think of popular programming languages.

All languages

    "There are two ways of constructing a software design. One way is to make it so
    simple that there are obviously no deficiencies. And the other way is to make it so
    complicated that there are no obvious deficiencies."

    Tony (C.A.R.) Hoare.
    Computing professor, implemented Algol 60, searcher at Microsoft Research. 

Algol 60 (Then taken in C)

    "I couldn't resist the temptation to put in a null reference, simply because it was
    so easy to implement. This has led to innumerable errors, vulnerabilities, and system
    crashes, which have probably caused a billion dollars of pain and damage in the last forty years."

    Tony (C.A.R.) Hoare.

↑これは例の「大失敗(選択ミス)」のあれですね。 前者は探せば訳があるだろうなあ。きっと。


Basic

    "It is practically impossible to teach good programming style to students that [sic]
    have had prior exposure to BASIC; as potential programmers they are mentally mutilated
    beyond hope of regeneration."

    E. W. Dijkstra in "The Threats to Computing Science" .
    Edsger Wybe Dijkstra contributed to the first Algol 60 compiler. Known for the Disjkstra algorithm and numerous contributions to computer science.

C
    "A C program is like a fast dance on a newly waxed dance floor by people carrying razors."

    Waldi Ravens. Programmer.

    "In My Egotistical Opinion, most people's C programs should be indented six feet downward and covered with dirt."

    Blair P. Houghton. Programmer.
略
PHP

    "PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl
    is a great and insidious evil, perpetrated by skilled but perverted professionals."

    Jon Ribbens. Programmer.

Bash and other shells

    "It is easier to port a shell than a shell script."
    (シェルを移植することはシェルスクリプトを移植するより簡単)

    Larry Wall. Creator of Perl.

And finally...

    "There are only two kinds of programming languages: those people always bitch about
    and those nobody uses.”
    (プログラミング言語にはたった二種類しかない。人々が罵る言語と誰も使わない言語と。)

    Bjarne Stroustrup.

Unfortunately, I believe he is right. However, there have always been two schools, one for
clear and safe languages (Pascal, and then scripting languages) and the other for languages
facilitating hacking but with random results.

■_

R と SAS の関係は Java と COBOL のそれのようなもの

R is to SAS as Java is to COBOL | (R news & tutorials)

R is to SAS as Java is to COBOL
May 18, 2012
By David Smith

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

An interview with Revolution Analytics CEO Dave Rich was published this week by 
BeyeNetwork. During the interview, Dace was asked about how the statistical modeling 
platforms have changed over the decades:

    People have been doing statistical modeling and predictive analytics for 50 years now,
    SAS and SPSS have been around since the early ‘70s. What's different now -- what's
    making this move toward other statistical and “big data” areas?

    David Rich: Well, I think obviously SAS and SPSS have been around, as you pointed out,
    for decades. We call that sort of the first generation of analytics and insight-driven
    solutions. In my perspective, having been in the business for more than three decades,
    it reminds me a bit of what COBOL was back in the day relative to business software. I
    see R as the more modern language. In this analogy, R would represent Java or C++. What
    happened in the middle of the nineties when the shift occurred is very similar to where 
    we are now with R. Open source is a worldwide collaboration innovation. It's a way to
    tap into that channel for research, and I think the role that Revolution Analytics can
    play – very similar to what Red Hat did back in the Linux days – is to be the conduit
    between the community and enterprise deployment.

以下略

SPSS って今でも結構遣われたんですねえ。 IBM の力?

■_ 5.16.0

リリース

Perl 5.16.0 is now available! - nntp.perl.org

The Perl 5 development team is gratified to announce the release of Perl 5.16.0!

You will soon be able to download Perl 5.16.0 from your favorite CPAN mirror or find it at:

https://metacpan.org/release/RJBS/perl-5.16.0/

SHA1 digests for this release are:

  56fb8097ff3e472f7a057848b37cb9ede7662b74  perl-5.16.0.tar.bz2
  d21de2b409d99440047a4e67a61f0a781ea2f66b  perl-5.16.0.tar.gz

You can find a full list of changes in the file "perldelta.pod" located in
the "pod" directory inside the release and on the web.

Perl 5.16.0 represents approximately 12 months of development since Perl
5.14.0 and contains approximately 590,000 lines of changes across 2,500
files from 139 authors.

(略)

詳しい変更点などはまとめてくださる人が出るでしょう。


一つ前へ 2012年5月(中旬)
一つ後へ 2012年6月(上旬)

ホームへ


リンクはご自由にどうぞ

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