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

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

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

ホームへ

2009年11月30日

■_

・カメラの日だったそうです

古典電脳物語―8085,Z80,CP/M,タイニーBASIC…
古典電脳物語―8085,Z80,CP/M,タイニーBASIC…
shibuya.lisp#4 以来、ちんまいインタープリターに興味がわきまして。 まあ FORTH あたりが手っ取り早いんだろうけど。 はっ。これは osaka.forth の流れ?

理想主義者 (ランダムハウス講談社文庫)
理想主義者 (ランダムハウス講談社文庫)
ジュンク堂で買っていたのを忘れて放置していた本(苦笑)。 三沢選手はとりたててひいきの選手ではなかったのですが、 ぱらぱらと読んでみてプロとしてのその意識の高さにあらためてびっくりしました。 第一章の見出しを挙げてみますが、プロレスに興味がなくても読みたくなりませんか?

  基本をおろそかにする者に勝利の女神は微笑まない
  人並みの能力でも、使い方しだいで長所になる
  突発的なアクシデントのときこそ、冷静さを保つ
  好きになるという才能
  素質のあるなしは他人が決めることではない
  信念は奇跡を呼ぶ
  失敗する勇気こそ成長への起爆剤
  自分の武器には、とことん惚れ込め
  華やかな舞台は、地味な練習を積み重ねた先にある

そして第三章には

  受け身をとれなくなったときが辞めどき

というものが。 さて、あなたにとっての「受け身」とは?

■_ GNU grep

メンテナーが増えたらしい。名前は前から見覚えがあるけどw

GNU grep New Maintainers

I am pleased to announce that Jim Meyering and Paolo Bonzini have been
appointed as co-maintainers of GNU grep.

Jim and Paolo have been involved in various GNU projects for many years
and they bring a lot of expertise to the project.

In the past couple of weeks, they made several long-over-due updates to
grep that brings it closer to the latest best practices in the GNU world
in terms of package management.

Summary of updates:

 1. convert repository to git
 2. remove intl directory
 3. make "make distcheck" pass
 4. rename autogen.sh to bootstrap with several updates
 5. cleaned up m4/ directory

They are now making a series of "gnulibification" updates.

Thanks, Jim and Paolo, and welcome aboard!

Cheers,

TAA

これも git 化か。

■_ もう一個GNUネタ

こっちは数日スレッドが伸びそうな気配。

supporting obscure languages
supporting obscure languages
From: 	Albert Cahalan
Subject: supporting obscure languages
Date: 	Thu, 26 Nov 2009 13:28:50 -0500

First, you may assume that the locale is UTF-8. We only care about
the messages and getting stuff like iswprint or towupper to work in
the default (no Turkish i, etc.) Unicode way.

Given a fairly normal program, how can the user force the use of a
specific known messages file? Consider /tmp/testfile.mo in a locale
that isn't otherwise defined in any way.

Now suppose that the file is stored in the expected place. The user
wants to use /usr/share/locale/zam/LC_MESSAGES/someprog.mo with a
program that claims to be someprog. Again, the locale isn't supported
in any other way; there is merely a *.mo file installed. Without
giving the full path, and with minimal complexity, how can the user
get this file to be used?

How can a program offer a non-environment way to override the source
of messages? The obvious setlocale(LC_ALL,"zam") does not work, nor
does the troublesome (because other locales need more) substitution
of setlocale(LC_MESSAGES,"zam").

BTW, please consider it a bug that that doesn't just work.

ん、you may assume that the locale is UTF-8 の may って 許可の may なんかな? 以下関連するメール。

http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00047.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00048.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00053.html

http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00052.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00054.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00055.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00056.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00058.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00057.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00060.html

http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00059.html

http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00062.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00061.html
http://lists.nongnu.org/archive/html/bug-gnu-utils/2009-11/msg00063.html

■_ ああ勘違い

さらに GNU ユーティリティのMLから。 ML。いけがみさんの今日の blog ネタではないけど、 流量がほとんどないのも ML って形態をとり続けているせいなんかね。

The awk bug
From: 	Kaplenko Vitaliy
Subject: 	The awk bug

If run in Linux localhost.localdomain 2.6.29.5-191.fc11.i686.PAE #1 SMP Tue Jun 16 23:19:53 EDT 2009 i686 i686 i386 GNU/Linux:

$ echo "./some_script" | awk 'gsub(".","a") {print $0}'
aaaaaaaaaaaaa


But must be:


$ echo "./some_script" | awk 'gsub(".","a") {print $0}'
a/some_script
The awk bug 2
From: 	Kaplenko Vitaliy
Subject: 	The awk bug 2

If run in Linux localhost.localdomain 2.6.29.5-191.fc11.i686.PAE #1 SMP Tue Jun 16 23:19:53 EDT 2009 i686 i686 i386 GNU/Linux:

$ echo "some_script" | awk 'gsub("/","a") {print $0}'
$


But must be:


$ echo "some_script" | awk 'gsub("/","a") {print $0}'
$ some_script

いやまあなんというか豪快な思い込みだなあ。 すでに回答がついてますが、 前者は任意の一文字にマッチする '.' は正規表現のメタ文字なので gsub によって全部のキャラクターを置き換えまくったと。 後者は gsub(...) が awk のルール部分として解釈されるので、 {print $0} が実行されるのは gsub(...) が0以外を返すときで、そしてそれは 置換が実際に起きたとき。ということで '/' は 'some_script' には存在していないから 置換も行われないので何も出力されないと。

■_ じゃんくしょん

Perl 5でも使えるライブラリがあるらしい。

use Modern::Perl; at blog.perls.org: Perl6::Junction
use Modern::Perl;
Tips and tricks for Perl developers.
Perl6::Junction
By hirschnase on November 28, 2009 7:10 AM under CPAN, Perl Modules I Like

Today I'd like to introduce you a Perl module I really like and use a lot in my code. 
It's called Perl6::Junction and you can get it from CPAN.

Please have a look what it can do for you.

Perl6::Junction comes in when you're working on Arrays. For example, if you'd like to 
search your array if it contains a defined element, usually your code will look like 
this:

my @animal = ('squirrel', 'cat', 'catfish', 'sausage-dog', 'guinea pig', 'pig');

# using a foreach loop to walk trough all array elements
#
foreach my $animal ( @animal ) {

    if ( $animal eq 'guinea pig' ) {

        # found my lovely guinea pig in this group of animals!
        last;
    }
}

# you could also go and use grep to search your array
#
if ( grep(/^guinea pig$/, @animal) ) {

    # found it!
}

But especially grep is not easy to use for beginners and one could make many mistakes 
when using it.

For example, just calling grep like grep('cat', @animal) will match every string in 
the array because it excepts a BLOCK or regular expression and not a string as first 
argument and interprets the string as 'TRUE' which matches everything.

Doing a grep(/cat/, @animal) will match every array element that contains the string 
'cat'. It would match 'cat' and 'catfish' in this example.

Most of the time, this is not really what you want.

When using Perl6::Junction it becomes as easy as this:

use Perl6::Junction qw( all any none one );

my @animal = ('squirrel', 'cat', 'catfish', 'sausage-dog', 'guinea pig', 'pig');

if ( any(@animal) eq 'guinea pig' ) {

    # one or more guinea pig's in the list of animals!}

if ( one(@ainmal) eq 'guinea pig' ) {

    # exactly one guinea pig in the list}

my @herd = ('sheep', 'sheep', 'wolf', 'sheep', 'sheep');

unless ( all(@herd) eq 'sheep' ) {

    # watch out!}

Pretty nice, right? :)

If I caught your interest, please have a look at more examples in the modules 
documentation at CPAN.

あれ、any だの all だのって List::Util にもなかったっけ?

■_


Java String Concatenation and Performance ~ Joey's Scribble's

Java String Concatenation and Performance

Published by Venish Joe on Sunday, November 08, 2009

The quick and dirty way to concatenate strings in Java is to use the concatenation 
operator (+). This will yield a reasonable performance if you need to combine two or 
three strings (fixed-size). But if you want to concatenate n strings in a loop, the 
performance degrades in multiples of n. Given that String is immutable, for large 
number of string concatenation operations, using (+) will give us a worst performance. 
But how bad ? How StringBuffer, StringBuilder or String.concat() performs if we put 
them on a performance test ?. This article will try to answer those questions.

Java において文字列を連結するための quick and dirty なやり方というのは連結演算子 (+) 
を使うというものです。この方法は二つ三つの固定長の文字列を繋ぎ合わせるのであれば、
reasonable なパフォーマンスが得られます。しかしもしあなたがループの中で n 個の文字列を
連結したいというのであれば、それを行ったときのパフォーマンスは multiples of n で劣化し
ます。immutable (変更することができない) 文字列が与えられたときに多くの回数の文字列の
連結操作をするために (+) を使うのは最悪のパフォーマンスを招くでしょう。でもそれはどの
くらいひどいものでしょうか?パフォーマンステストを行ったらStringBuffer や StringBuilder、 
String.concat() の性能はどのくらいなのでしょうか?この article はそういった疑問に答えよ
うとするものです。

We will be using Perf4J to calculate the performance, since this library will give us
aggregated performance statistics like mean, minimum, maximum, standard deviation over
a set time span. In the code, we will concatenate a string (*) repeatedly 50,000 times
and this iteration will be performed 21 times so that we can get a good standard
deviation. The following methods will be used to concatenate strings.

わたしたちはパフォーマンスを計測するのに Perf4J を使用します。それはこのライブラリが平
均、最小、最大、標準偏差 のような設定した単位時間についてのaggregated performance 
statistics を提供してくれるからですこのコードでは良い標準偏差を得られるように文字列の
連結を五万回繰り返し、さらにその iteration を21回行います。

以下のメソッド群が文字列を連結するのに使われます。

    * Concatenation Operator (+)
      連結演算子

    * String concat method - concat(String str)
      String の concat メソッド

    * StringBuffer append method - append(String str)
      StringBuffer の append メソッド

    * StringBuilder append method - append(String str)
      StringBuilder の append メソッド

And finally we will look at the byte code to see how each of these operations perform.
Let's start building the class. Note that each of the block in the code should be
wrapped around the Perf4J library to calculate the performance in each iteration. Let's
define the outer and inner iterations first.

そしてこれらの操作のそれぞれがどのくらいの性能なのかを見るために最終的にはバイトコード
を調べることになるでしょう。ではクラスの構築を始めましょう。このコードの中の各ブロック
はそれぞれの iteration のパフォーマンスを計測するためにPerf4J ライブラリで囲まれている
ようにすべきことに注意しましょう。まず初めに外側と内側の繰り返しの回数を定義します。

1	private static final int OUTER_ITERATION=20;
2	private static final int INNER_ITERATION=50000;

Now let's implement each of the four methods mentioned in the article. Nothing fancy
here, plain implementations of (+), String.concat(), StringBuffer.append() &
StringBuilder.append().

今度は本 atrticle で言及している四つのメソッドをそれぞれ実装します。
Nothing fancy here, plain implementations of (+), String.concat(),
StringBuffer.append() & StringBuilder.append().


01	String addTestStr = "";
02	String concatTestStr = "";
03	StringBuffer concatTestSb = null;
04	StringBuilder concatTestSbu = null;
05	
06	for (int outerIndex=0;outerIndex<=OUTER_ITERATION;outerIndex++) {
07	    StopWatch stopWatch = new LoggingStopWatch("StringAddConcat");
08	    addTestStr = "";
09	    for (int innerIndex=0;innerIndex<=INNER_ITERATION;innerIndex++)
10	    addTestStr += "*";
11	    stopWatch.stop();
12	}
13	
14	for (int outerIndex=0;outerIndex<=OUTER_ITERATION;outerIndex++) {
15	    StopWatch stopWatch = new LoggingStopWatch("StringConcat");
16	    concatTestStr = "";
17	    for (int innerIndex=0;innerIndex<=INNER_ITERATION;innerIndex++)
18	    concatTestStr = concatTestStr.concat("*");
19	    stopWatch.stop();
20	}
21	
22	for (int outerIndex=0;outerIndex<=OUTER_ITERATION;outerIndex++) {
23	    StopWatch stopWatch = new LoggingStopWatch("StringBufferConcat");
24	    concatTestSb = new StringBuffer();
25	    for (int innerIndex=0;innerIndex<=INNER_ITERATION;innerIndex++)
26	    concatTestSb.append("*");
27	    stopWatch.stop();
28	}
29	
30	for (int outerIndex=0;outerIndex<=OUTER_ITERATION;outerIndex++) {
31	    StopWatch stopWatch = new LoggingStopWatch("StringBuilderConcat");
32	    concatTestSbu = new StringBuilder();
33	    for (int innerIndex=0;innerIndex<=INNER_ITERATION;innerIndex++)
34	    concatTestSbu.append("*");
35	    stopWatch.stop();
36	}

Let's run this program and generate the performance metrics. I ran this program in a
64-bit OS (Windows 7), 32-bit JVM (7-ea), Core 2 Quad CPU (2.00 GHz) with 4 GB RAM.

このプログラムを実行してパフォーマンス指標 (performance metrics) を生成してみましょう。
わたしはこれを 4 GB RAM 搭載の 64-bit OS (Windows 7), 32-bit JVM (7-ea),
Core 2 Quad CPU (2.00 GHz) という環境で実行しました。

The output from the 21 iterations of the program is plotted below.

 String_Perf_Chart_2

Well, the results are pretty conclusive and as expected. One interesting point to
notice is how better String.concat performs. We all know String is immutable, then how
the performance of concat is better. To answer the question we should look at the byte
code. I have included the whole byte code in the download package, but let’s have a
look at the below snippet.

この結果はとても決定的であり予想されたものです。興味深い、注意しておくべき点は 、
String.concat のパフォーマンスがどのくらい良いものかということです。わたしたちはみな 
String  が immutable であることを知っていますから、concat のパフォーマンスがどのくらい良
いのかに注目します。この質問に回答するためにわたしたちはバイトコードにも目を向けるべき
でしょう。わたしはダウンロードパッケージにはバイトコード全体を含めましたが、ここではそ
の一部分だけを見ることにしましょう。

01	45: new #7; //class java/lang/StringBuilder
02	48: dup
03	49: invokespecial   #8; //Method java/lang/StringBuilder."<init>":()V
04	52: aload_1
05	53: invokevirtual   #9; //Method java/lang/StringBuilder.append:
06	                (Ljava/lang/String;)Ljava/lang/StringBuilder;
07	56: ldc #10; //String *
08	58: invokevirtual   #9; //Method java/lang/StringBuilder.append:
09	                (Ljava/lang/String;)Ljava/lang/StringBuilder;
10	61: invokevirtual   #11; //Method java/lang/StringBuilder.toString:()
11	                Ljava/lang/String;
12	64: astore_1

This is the byte code for String.concat(), and its clear from this that the
String.concat is using StringBuilder for concatenation and the performance should be
as good as String Builder. But given that the source object being used is String, we
do have some performance loss in String.concat.

これは String.concat() のバイトコードです。これを見ると String.concat が連結のために 
StringBuilder を使っていることと、String.concat を使ったときのパフォーマンスが String 
Builder を使ったときと同じくらい良いものであるべきだということがはっきりわかります。
しかしソースオブジェクトに String を使うようにするとString.concat の場合には多少のパ
フォーマンスの劣化が起きています。

So for the simple operations we should use String.concat compared to (+), if we don't
want to create a new instance of StringBuffer/Builder. But for huge operations, we
shouldn't be using the concat operator, as seen in the performance results it will
bring down the application to its knees and spike up the CPU utilization. To have the
best performance, the clear choice is StringBuilder as long as you do not need
thread-safety or synchronization.

ですからもし  StringBuffer や StringBuilder の新しいインスタンスの生成をしたくないとき
の単純な操作が目的であれば(+) よりも String.concat を使うべきなのです。しかし規模が大
きな操作 (huge operations) の場合にはconcat 演算子を使うべきではありません。それはパフ
ォーマンスの結果に見られるように
it will bring down the application to its knees and spike up the CPU utilization.

ベストなパフォーマンスを得るには、
スレッド安全性 (thread-safety) や 同期 (synchronization) を必要としない場合は
StringBuilder が明らかな選択肢となります。

The full source code, compiled class & the byte code is available for download in
the below link.

Download Source, Class & Byte Code: String_Concatenation _Performance.zip

Posted by Venish Joe

■_ 本日の巡回から

2009年11月29日

■_

忘れたた
TokyuRuby会議01 - Regional RubyKaigi まあ覚えててもちと厳しかったですが。

・水滸伝
漫画で読んだ気になるシリーズ(勝手に命名)で水滸伝を見かけました。 ふつーの文庫本と同じ棚に置かれていたのですが、コミックと同じようにシュリンクかけられていたので 中身は確認できず。しかしあれをあの分量のコミックに収めるのはどういう端折り方を…

・坂の上の雲
日露戦争の陸戦はどう描写するのかなあと今から考えてたり。

・アナタたちって人は…(笑)
jijixi's diary - プリニー日記、練武の塔 , アレが届いてしまったわけだが ツインスティックEX が笑っちゃうくらいに大きかった件 - みねこあ

・マネー革命
図書館で借りて読んでいるんですが、十年前のNHKスペシャルでこういうのをやっていたとは (プロデューサーは「電子立国」と同じ相田洋さん)。 なんというか今放送しても違和感がないような気がしないでも。

・ぎく



プログラミングの下手な奴の特徴 0x01 [chaika]
99 仕様書無しさん [] 2009/11/28(土) 11:48:44 ID: Be:
    買ったのに読まない本が10冊以上ある(買ったのに糞本だった場合を除く) 

■_ @ITって微妙

ベンチャー社長の記事もおいおいってな感じだったけど、その紹介記事が輪をかけて ひどい表現だったのでクレームのメール送ったものの返ってきたのは以下略 でしたとさ。 これはもうダメかもわからんね インフラ系SEの波瀾万丈伝: ゼッパチとトランジスタ技術の頃


 命令語も簡単で、A(演算)レジスタにぶち込んで、ビット操作、論理演算、インクリメント。
また、強引にIX(インデックス)レジスタにアドレスをぶち込めば、プログラムの実行先(ポイ
ンタ)を変えることもできました。ローテイトシフト(数珠つなぎになった0と1を左右にずらす)
ってまだ概念として残っているのでしょうか。新しいのをやったことがないのでよく分かりませ
ん。そして現在でも「2の補数」で引き算をやったりするのでしょうか。

別に IX レジスター以外にも IY やら HLでも書き換えはできると思うんですがなぜ IX限定。 ローテートとシフトは別物で、「ローテートシフト」なんてまとめて書くようなことは しないと思うんですが。 rotating shiftの意味 英和辞典 - goo辞書 という熟語はありますけど。

 今のFORTRANには行番号がたぶんないと思う(構造化されていて)のですが、当時のFORTRANに は、きっちり行番号がありました。

FORTRAN のあれは「文番号」で「行番号」ではありません。 wikipedia に「行番号」ってなってるところあるな…

 年を経ても絶対に忘れていないのが、最初の定義文。たとえば、 「IDENTIFICATION DIVISION」とかいう、 変数定義です。

>

…え?

鑽孔テープ。つまり、テレタイプ装置で打鍵する、 一般の生徒は、256KBの8インチフロッピー(2D)に  そこからラインプリンター(大きなドットインパクトプリンター)

■_

■_ GPL

【GNU】アンチGPLなプログラマ【汚染対策】 [chaika]
178 仕様書無しさん [] 2009/11/27(金) 11:04:03 ID: Be:
    結局GPLライセンス使ってAというDLL作りました

    プログラムBはそれを利用しています。

    この時ソースコードはどこまで公開しなきゃいけないんだ? 

179 仕様書無しさん [sage] 2009/11/27(金) 11:06:17 ID: Be:
    >>178
    Bだけでおk 

180 仕様書無しさん [sage] 2009/11/27(金) 11:07:09 ID: Be:
    >>179
    そういうことなのか
    やっぱ勘違いしかけてた
    サンクス! 

181 仕様書無しさん [sage] 2009/11/27(金) 11:11:11 ID: Be:
    >>178
    Aの著作権を貴方が持っているなら、BがどういうライセンスでAを利用しようと貴方の自由。 

182 仕様書無しさん [sage] 2009/11/27(金) 12:48:23 ID: Be:
    >>178
    AとBの両方だろJK。 

183 仕様書無しさん [sage] 2009/11/27(金) 13:16:54 ID: Be:
    成果物[ライセンス/ソフトウェアの種類]と表すとき

    A[GPL/DLL] <- B[foo/Program]
    つまり、BがAを参照する関係にあるとき
    BをAの派生物とみなし、fooはGPLになる
    よって、成果物A, Bのソースコードを公開する必要がある
    と言うのが、公式見解だけど

    一般的には、動的リンクしているプログラムは、派生物ではないという認識であるので
    Bのライセンスは自由である
    よって、成果物Aのソースコードを公開する必要がある
    成果物Bのソースコードは公開してもしなくてもよい

    というのでいいのかな 

184 仕様書無しさん [sage] 2009/11/27(金) 13:21:11 ID: Be:
    狂信的GPL信者がそれで納得してくれればな。
    奴らは法を超えて騒ぎ立てるから。 

185 仕様書無しさん [sage] 2009/11/27(金) 13:34:23 ID: Be:
    狂信的アンチGPL乙 

186 仕様書無しさん [sage] 2009/11/27(金) 13:35:28 ID: Be:
    >>184 が言うことが真実ならLinux界隈は今頃大騒ぎのはずなんだなw 

187 仕様書無しさん [sage] 2009/11/27(金) 16:43:23 ID: Be:
    >>181-183
    どれが本当なんだよ… 

188 仕様書無しさん [sage] 2009/11/27(金) 16:45:26 ID: Be:
    捉え方次第ってところなのかな・・・・ 

189 仕様書無しさん [sage] 2009/11/27(金) 16:46:02 ID: Be:
    2ちゃんねるなんかあてにするなよ。 

190 仕様書無しさん [sage] 2009/11/27(金) 20:44:36 ID: Be:
    >結局GPLライセンス使ってAというDLL作りました
    この部分が意味不明なんだよ。
    >>178が自分でフルスクラッチでAというDLLを作って、GPLで公開したのか
    GPLで公開されているソース、DLLを使ってAを作ったのかがわからない。
    前者ならA,Bの公開は自由。
    後者なら全部公開。

    LGPLで公開されているソース、DLLを使ってAを作ったのなら
    Aの公開だけが義務となり、Bの公開は自由。 

191 仕様書無しさん [sage] 2009/11/27(金) 23:11:31 ID: Be:
    後者だって、Bの中にAの要素を一切含まないならBのライセンスは自由だな。
    状況によっては「GPL逃れ」と非難されるかも知れんが。 

192 仕様書無しさん [sage] 2009/11/29(日) 21:36:19  ID: Be:
    同一プロセス内にGPLなやつが来ると、揉める元になるから、普通それは避けるんじゃね 

193 仕様書無しさん [sage] 2009/11/29(日) 22:38:43 ID: Be:
    同一プロセス云々というのは本来関係ないだろう。
    揉め事にしたがる人間はいるかも知れんが。 

FSF の見解では 183 のケースもGPL縛りを受けるんじゃなかったけか。

■_ 入門書

推薦図書/必読書のためのスレッド 53 
20 デフォルトの名無しさん [sage] 2009/11/26(木) 18:21:22 ID: Be:
    STL のいい参考書はありませんか。
    手元にはエピステーメー氏のものがありますが、飛躍が多くて読みづらいのです。 

22 デフォルトの名無しさん [sage] 2009/11/26(木) 19:03:44 ID: Be:
    >>20
    c++標準ライブラリ チュートリアル&リファレンス 

23 デフォルトの名無しさん [sage] 2009/11/26(木) 19:04:12 ID: Be:
    Effective STL でいいんじゃない 

27 デフォルトの名無しさん [sage] 2009/11/26(木) 21:43:55 ID: Be:
    >23
    Effective STL は一通り基本を押さえた後で、ありがちな落とし穴に落ちないために読む本だと思う。 

29 デフォルトの名無しさん [sage] 2009/11/26(木) 21:49:34 ID: Be:
    Effective OpenCLはまだかよ 

30 デフォルトの名無しさん [sage] 2009/11/26(木) 21:54:43 ID: Be:
    Effective Aはまだかよ 

31 デフォルトの名無しさん [sage] 2009/11/26(木) 22:12:53 ID: Be:
    Effective Effective Javaは? 

32 デフォルトの名無しさん [] 2009/11/26(木) 22:22:46 ID: Be:
    Effective Goとかいらねーし 

33 デフォルトの名無しさん [sage] 2009/11/26(木) 23:09:55 ID: Be:
    Effective Brainf*ck と Effective Malbolge が欲しい 

34 デフォルトの名無しさん [] 2009/11/26(木) 23:13:10 ID: Be:
    Effective ラブプラス 

35 デフォルトの名無しさん [sage] 2009/11/26(木) 23:13:38 ID: Be:
    Effective English が欲しい
    マジで 

36 デフォルトの名無しさん [sage] 2009/11/26(木) 23:14:24 ID: Be:
    NGワード
    Effective 

37 デフォルトの名無しさん [sage] 2009/11/26(木) 23:15:32 ID: Be:
    それをNGするなんてとんでもない! 

38 デフォルトの名無しさん [] 2009/11/26(木) 23:20:09 ID: Be:
    次は、やさしいで行こう 

39 デフォルトの名無しさん [sage] 2009/11/26(木) 23:24:23 ID: Be:
    詳説でもいいな 

40 デフォルトの名無しさん [sage] 2009/11/26(木) 23:49:11 ID: Be:
    独習だろjk 

41 デフォルトの名無しさん [] 2009/11/26(木) 23:50:52 ID: Be:
    独習はマジでびっくりするようなのが普通に出てるからな 

42 デフォルトの名無しさん [sage] 2009/11/27(金) 00:03:55 ID: Be:
    独習2ちゃんねる 

43 デフォルトの名無しさん [sage] 2009/11/27(金) 00:05:31 ID: Be:
    いまどきのScala 

44 デフォルトの名無しさん [sage] 2009/11/27(金) 00:15:13 ID: Be:
    誰得 

45 デフォルトの名無しさん [sage] 2009/11/27(金) 01:32:12 ID: Be:
    アルゴリズムの本ばっかり読もうと思います。 

46 デフォルトの名無しさん [sage] 2009/11/27(金) 01:52:30 ID: Be:
    Effective C は素直に欲しいなぁ。 

47 デフォルトの名無しさん [sage] 2009/11/27(金) 02:27:49 ID: Be:
    今更Cとかなにする気だよ
    最新の言語からしたら化石みたいなもんだろ 

48 デフォルトの名無しさん [sage] 2009/11/27(金) 02:52:54 ID: Be:
    その最新の言語もほとんどその化石からの派生だろう 

49 デフォルトの名無しさん [sage] 2009/11/27(金) 02:58:08 ID: Be:
    Cは恐竜の化石じゃないよ。シーラカンス辺りかな 

50 デフォルトの名無しさん [sage] 2009/11/27(金) 03:06:15 ID: Be:
    Cで作られたライブラリは俺の頭脳では使うのが難しい
    C++でラッパーを作ってくれ 

59 デフォルトの名無しさん [sage] 2009/11/27(金) 17:10:28 ID: Be:
    自分のレベルに合った本を買えばいいのにね。
    ま、俺もそうなんだが。とりあえず参考になりそうなのは買ってしまう。
    んで使わない奴はずーっと保存しておいて、第二版とかが出てへこむ(特にオライリーw) 

61 デフォルトの名無しさん [sage] 2009/11/27(金) 18:29:54 ID: Be:
    買ったらそれで満足しちゃってあとは積んでおくだけになってしまうんだよ 

まあCERT のセキュアコーディングがある意味 Effective C の範囲をカバーしている鴨

正規表現 Part6 
625 デフォルトの名無しさん [sage] 2009/11/29(日) 13:29:56 ID: Be:
    "a1a2" =~ /([a-z][0-9])+/
    p $1
    p $2

    これで$1に"a1" $2に"a2"になるようには出来ませんか?
    "a1a2" =~ /([a-z][0-9])([a-z][0-9])/
    コレなら行くんですが・・・ 

626 デフォルトの名無しさん [sage] 2009/11/29(日) 13:36:41 ID: Be:
    ? 

627 デフォルトの名無しさん [sage] 2009/11/29(日) 15:03:10 ID: Be:
    エスパー的にはscan使えでよさげ 

628 デフォルトの名無しさん [sage] 2009/11/29(日) 18:56:11 ID: Be:
    正規表現を学習したいのですが、自分の県には何処に行っても正規表現の本が辞典(リファレンス)以外売っていません
    何か段階的に学習出来るお勧めの書物はないでしょうか?

629 デフォルトの名無しさん [sage] 2009/11/29(日) 18:57:28 ID: Be:
    とりあえずふくろう本 

630 デフォルトの名無しさん [sage] 2009/11/29(日) 19:45:57 ID: Be:
    >>628
    629さんも言ってる通り、正規表現の本はオライリーのフクロウしか選択肢が無いかも。

    あとはネットで勉強すると良いかも。
    パターンを何回自分で作ったかによるところが多いから、
    PHPチェッカーで作りつつ勉強して、正規表現パズルで息抜きして。
    って感じで、フクロウと併用するといいかも。 

631 デフォルトの名無しさん [sage] 2009/11/29(日) 20:07:32 ID: Be:
    体で覚えるのも一つの方法だな。
    オレみたいに頭の弱いヤツなら。
    正規表現検索機能つきのテキストエディタで試行錯誤してれば
    すぐに覚えられるよ。
    unix の ed とか、まるで「正規表現養成ギブス」だもんな。 

632 デフォルトの名無しさん [sage] 2009/11/29(日) 20:09:40 ID: Be:
    >>631
    大丈夫、EDは治療できます。安心してください 

633 デフォルトの名無しさん [sage] 2009/11/29(日) 20:22:11 ID: Be:
    パズルとかよりエロデータ整理とか
    ダウンロードの方が覚えると思うが。。。

625 のご希望は使っている言語(かエディターか)がわからないとなんともいえないな。 Ruby なら627 の通り scan だし、Python なら findall。 Perl なら g 修飾子の追加とリストコンテキストでの実行とか。 628 の注文がどういうレベルかわからないけど、perl の配布アーカイブに入ってる perlretut もオススメ。まあこれを終えても、拡張機能山盛りな超絶なパターンは 書けないだろうけど。

■_ もにゃど

とりあえず紹介だけ。

What a Monad is not - HaskellWiki

What a Monad is not

Contents

    * 1 Warning
    * 2 Monads are not a good choice as topic for your first Haskell blog entry
    * 3 Monads are not a language feature
    * 4 Haskell doesn't need Monads
    * 5 Monads are not impure
    * 6 Monads are not about state
    * 7 Monads are not about strictness
    * 8 Monads are not values
    * 9 Monads are not a replacement for applicative functors
    * 10 Monads are not about ordering


1 Warning

This page is currently an unprocessed braindump. Feel free to dump additional stuff or 
massage stuff into didactic pleasures.

Also, don't be surprised if you leave this page more confused than before. That just 
means that it has successfully destroyed your false assumptions, or that you've fallen 
for some horrible inside joke. Beware of Zygohistomorphic prepromorphisms. Go for warm 
and fuzzy, instead.

2 Monads are not a good choice as topic for your first Haskell blog entry
  モナドはあなたが最初のHaskell blogのエントリのトピックには良い選択ではない

(ry)

3 Monads are not a language feature
  モナドは言語の機能ではない

(ry

4 Haskell doesn't need Monads
  Haskell はモナドを必須としない

(ry

5 Monads are not impure
  モナドは impure ではない

(ry

6 Monads are not about state
モナドは状態に関するものではない

(ry

7 Monads are not about strictness
モナドは strictness (厳密さ)(正格性) についてのものではない

(ry

8 Monads are not values
  モナドは値ではない

(ry

9 Monads are not a replacement for applicative functors
  モナドは applicative functors の置き換えではない

(ry

10 Monads are not about ordering
  モナドは ordering についてのものではない

Retrieved from "http://www.haskell.org/haskellwiki/What_a_Monad_is_not"

This page has been accessed 11,695 times. This page was last modified 22:43, 23 
November 2009. Recent content is available under a simple permissive license.

Recent content is available under a simple permissive license.

applicative functors って、さいきんいけがみさんが云ってた appicative に 関係の深いものだったりするんだろうか。

■_ 本日の巡回から

ついったからのが多いなあ。Tumblr がもうちょっと使えればなあ。

2009年11月28日

■_

・本日のAA

お名前.comはここで語れ その4/a>
995 名無しさん@お腹いっぱい。 [sage] 2009/11/28(土) 07:16:15 0 ID: Be:
                   _,.__
                ぇYにェt:、ヽ
               /´   `ミ、}} ハ
                  {     i.j!゙レ' }
               !|i    i lj| |_,.ィ
               |l!{、川!l|lfT´ lヘ
                   |!Y^t_lリi^| _,ゝ、)
              r'r_ノ   r' 〔
                      ⌒` 

よくできてるなw

マジすか
今日、来月のカードの引き落とし額見て愕然としたところなので ○| ̄|_
Twitter / AKIBA PC Hotline!: 「音々ちゃんネットブック値下げしました¥39800」 ... まあ半額になったとかそういうレベルではないのでまだ傷は浅いですがw

■_ dark corner

gawk のドキュメントの dark corner を見ていけば、 複数の処理系使うときのいろいろな落とし穴が見つかったりします。


corbieのブログ:mawkとgawk (4) - バックスラッシュ2個に置換する

awkの入力テキストにバックスラッシュ“\”があって、それをgsub()でマッチさせて、バックス
ラッシュ2個“\\”に置換して出力したい。

類似の話として、 mawkとgawkのバックスラッシュのエスケープ処理の違いについて、 8月22日
の記事にも書きましたが、今回は正規表現側ではなく、置換後の文字列の話です。

gsub()の置換文字列に指定する“\”はいくつ重ねればよいのでしょうか?
以下のawkプログラムa.awkで試します。

{
    a = b = c = $0
    gsub(/\\/, "\\", a)
    gsub(/\\/, "\\\\", b)
    gsub(/\\/, "\\\\\\", c)

    printf "a=%s\n", a
    printf "b=%s\n", b
    printf "c=%s\n", c
}

入力に“\”のみ与えたとき、3つのgsub()のうちどれが望みの結果“\\”を得るか?
まずは、gawk

$ gawk -f a.awk
\
a=\
b=\\
c=\\\

直感どおり、2番目のgsub()でOK。
次にmawk。

$ mawk -f a.awk
\
a=\
b=\
c=\\

3つ目のgsub()、“\”の6連が必要! 読みにくいコードになりますね。
mawk/gawk両方で動かすには、こんなような処理をかますしかないのか…

function escape_string(s,    x)
{
    x = (ARGV[0] == "mawk")? "\\\\\\": "\\\\"
    gsub(/\\/, x, s)
    return s
}

6個といういのは変だなあ。 エスケープで減るパターンを考えれば倍々で増えてくと思うんだけど。 まあ、半端が出たときにどうなるかというのにも関係するからありえなくもないのか。 試しに上のスクリプトで、\ の八個重ねも追加してやると

echo \|mawk -f mm.awk
a=\
b=\
c=\\
c=\\

これはこれでつじつまが合うけど、\\\\ が最終的に \ になるということは 二回エスケープされないといけない (\\\\ → \\ → \) のだけど どこでその処理がされているんだろう? 一回は文字列リテラルのスキャンだけど。

面倒なのでこっちからいくか(笑)



corbieのブログ:mawkとgawk (3) - 数値比較と型変換
mawkとgawk (3) - 数値比較と型変換

あるawkプログラムを実行中、変数a, bの数値を何度確認しても「aはbより大きかったはず」な
のに、mawkはif (a > b) { .... }の中を実行してくれない。こんなところにもmawkの落とし穴
が…

以下は、変数fooより大きな数値が入力されたらfooを更新するawkプログラムtest.awkです。
入力時、$1の頭に英字があったら剥がして数字のみ取り出します。←ここ重要

BEGIN { foo = 0 }
{
    val = get_value($1)
    if (val > foo) {
        foo = val
        printf "True: "
    } else {
        printf "False: "
    }
    printf "%d %d\n", val, foo
}

function get_value(s)
{
    gsub(/^[a-z]+/, "", s)
    return s
}

これをmawkで実行すると、最初に50、次に120が来ても直感に反してfooは50のままです。ところ
が、60が来るとfooは更新されます。

$ mawk -f test.awk
a50
True: 50 50
a120
False: 120 50
a200
False: 200 50
a60
True: 60 60

gawkの場合、望みどおりの結果になります。

$ gawk -f test.awk
a50
True: 50 50
a120
True: 120 120
a200
True: 200 200
a60
False: 60 200

どうやらmawkは、if (val > foo)を数値でなく文字列どおしで比較したようです:
"120" < "50", "60" > "50"
$1が数字のみの場合、gsub()の効力が及ばないためmawkでも期待した結果になります。

$ mawk -f test.awk
50
True: 50 50
120
True: 120 120
200
True: 200 200
60
False: 60 200

解決法
if文の直前にval = val + 0を入れるか、gsub()の後にをs = s + 0を入れると、mawkは数値とし
て扱ってくれます。

    val = get_value($1)
    val = val + 0	# for mawk
    if (val > foo) {

または

function get_value(s)
{
    gsub(/^[a-z]+/, "", s)
    s = s + 0	# for mawk
    return s
}

スタイルとしては後者のほうがよさそうですが、戻り値を代入した変数を使いまわしてるうちに
文字列扱いに戻ったりしそう。汚いですが、if()の直前にその“おまじない”を入れるのが確実
かもしれません。

mawkのmanより:

    The type of an expression is determined by its context and automatic type 
    conversion occurs if needed.
    ...
    Explicit type conversions can be forced, expr "" is string and expr+0 is 
numeric.

+0 したり "" を連接したりして数値化や文字列化を強制するのは 割と知られたイディオムだったと思うけど時代かねえ。 Perl だと文字列比較と数値比較で演算子違うし、 Python や Ruby なら型変換しないと例外が飛ぶと。

んでまあ、元記事にあるとおりスクリプトの書き手が気をつけて、 必要に応じて文字列化や数値化を強制することになるんだけど、 一応どちらの比較を行うかは明確に文書化されてはいる。 ただ、mawk は実装された時期が微妙な時期なので動作が変な可能性はあるけど、 gsub(/^[a-z]+/, "", s) の置換を行った時点で「文字列属性」 しかなくなったんじゃないかなあ。

ほかの awk じゃどうなんだろう。Sun のやら One True やら。 あー、UNIX V7のソース公開されてたし、あの awk をビルドしてみるか。

んでは以下前述した規則について gawkのマニュアルから。

 5.10 変数の型付けと比較式

    The Guide is definitive. Reality is frequently inaccurate.
    The Hitchhiker's Guide to the Galaxy 

他のプログラミング言語とは異なり、awkの変数は固定した型を持っておらず、なにから代入さ
れたかによって数値にも文字列にもなる

1992年のPOSIX標準では、数値文字列(numeric string)の概念が導入された。これは" +2"のよう
な、数値のように見える文字列である。この概念は変数の型を決定するのに使われる。変数の型
は二つの変数をどのように比較するのかを決定するのに影響するので、非常に重要である。 
gawkでは、変数の型は以下のルールに従う。

    * 数値リテラルや数値演算の結果は数値属性を持つ。
    * 文字列リテラルや文字列演算の結果は文字列属性を持つ。
    * フィールド、getline入力、FILENAME、ARGVの要素、 ENVIRONの要素、splitで作成された配列の
      要素、といったもので数値文字列のものは数値文字列属性を持っている。それ以外(数値文字列
      でないもの)は文字列属性を持つ。初期化されていない変数は同様に数値文字列属性を持つ。
    * 属性は代入を通じて伝播するが使用することによって変ることはない。 

この最後のルールは特に重要である。次のプログラムでは、 aは文字列演算の後でも数値タイプを持つ。

BEGIN {
         a = 12.345
         b = a " is a cute number"
         print b
}

二つのオペランドを比較するときは、オペランドの属性によって文字列演算子か数値演算子のい
ずれかが以下の一覧に従って決定され、使用される。

        +----------------------------------------------
        |       STRING          NUMERIC         STRNUM
--------+----------------------------------------------
        |
STRING  |       文字列          文字列          文字列
        |
NUMERIC |       文字列          数値            数値
        |
STRNUM  |       文字列          数値            数値
--------+----------------------------------------------
   

基本的な考え方は、ユーザーの入力が数値のように見え、ユーザーが入力だけ行ったときのみ数
値であり、そのデータがキャラクタから構成されていた場合にはそれは文字列であるというもの
である。したがって、たとえば" +3.14"という文字列定数は数値のように見えるが文字列であり、
比較のために数値として扱われることはない。

まとめると、一つのオペランドが文字列定数のような``純粋な''文字列であるとき、文字列比較
が行われる。そうでなければ数値比較が行われる。 (25) 
  

む、十年以上前に訳した部分だけあって(たぶん)、誤訳くさいところがががが。 改訂されている部分もあるかもしれないけど、原文はこう。



The GNU Awk User's Guide
5.10.1 String Type Versus Numeric Type

The 1992 POSIX standard introduced the concept of a numeric string, which is simply a 
string that looks like a number—for example, " +2". This concept is used for 
determining the type of a variable. The type of the variable is important because the 
types of two variables determine how they are compared. In gawk, variable typing 
follows these rules:

    * A numeric constant or the result of a numeric operation has the numeric attribute.
    * A string constant or the result of a string operation has the string attribute.
    * Fields, getline input, FILENAME, ARGV elements, ENVIRON elements, and the elements of
      an array created by split and match that are numeric strings have the strnum attribute.
      Otherwise, they have the string attribute. Uninitialized variables also have the strnum
      attribute.
    * Attributes propagate across assignments but are not changed by any use. 

The last rule is particularly important. In the following program, a has numeric type, 
even though it is later used in a string operation:

     BEGIN {
          a = 12.345
          b = a " is a cute number"
          print b
     }

When two operands are compared, either string comparison or numeric comparison may be 
used. This depends upon the attributes of the operands, according to the following 
symmetric matrix:

             +——————————————————————–
             |       STRING          NUMERIC         STRNUM
     ———–+——————————————————————–
             |
     STRING  |       string          string          string
             |
     NUMERIC |       string          numeric         numeric
             |
     STRNUM  |       string          numeric         numeric
     ———–+——————————————————————–

The basic idea is that user input that looks numeric—and only user input—should be 
treated as numeric, even though it is actually made of characters and is therefore 
also a string. Thus, for example, the string constant " +3.14", when it 
appears in program source code, is a string—even though it looks numeric—and is never 
treated as number for comparison purposes.

In short, when one operand is a “pure” string, such as a string constant, then a 
string comparison is performed. Otherwise, a numeric comparison is performed.(26)

The basic idea のパラグラフはこうかな。

基本的な考え方はこうである。 数値のように見え、かつそれがユーザーからの入力であったときにだけ 数値として扱われるべきであり、たとえ数字のキャラクターから構成されているものであっても それは文字列として扱うべきものである。したがってたとえば " +3.14" という文字列定数がプログラムのソースコードの中に現れた場合、 たとえ数値のような外見であったとしてもそれは文字列なのであり、 決して比較のときに数値として扱われることはない。

訳はさておき、gawk (3.1.7) と mawk (1.3.3 でわたしがちょっといじったもの) のソースから。

まずは mawk の比較を行う部分のコード。

execute.c

/* compare cells at cp and cp+1 and
   frees STRINGs at those cells
*/
static int
compare(cp)
   register CELL *cp ;
{
   int k ;

 reswitch:

   switch (TEST2(cp))
   {
      case TWO_NOINITS:
	 return 0 ;

      case TWO_DOUBLES:
       two_d:
	 return cp->dval > (cp + 1)->dval ? 1 :
	    cp->dval < (cp + 1)->dval ? -1 : 0 ;

      case TWO_STRINGS:
      case STRING_AND_STRNUM:
       two_s:
	 k = strcmp(string(cp)->str, string(cp + 1)->str) ;
	 free_STRING(string(cp)) ;
	 free_STRING(string(cp + 1)) ;
	 return k ;

      case NOINIT_AND_DOUBLE:
      case NOINIT_AND_STRNUM:
      case DOUBLE_AND_STRNUM:
      case TWO_STRNUMS:
	 cast2_to_d(cp) ; goto two_d ;
      case NOINIT_AND_STRING:
      case DOUBLE_AND_STRING:
	 cast2_to_s(cp) ; goto two_s ;
      case TWO_MBSTRNS:
	 check_strnum(cp) ; check_strnum(cp+1) ;
	 goto reswitch ;

      case NOINIT_AND_MBSTRN:
      case DOUBLE_AND_MBSTRN:
      case STRING_AND_MBSTRN:
      case STRNUM_AND_MBSTRN:
	 check_strnum(cp->type == C_MBSTRN ? cp : cp + 1) ;
	 goto reswitch ;

      default:			/* there are no default cases */
	 bozo("bad cell type passed to compare") ;
   }
   return 0 ;			 /* shut up */
}

流れを把握しないとわかりづらいところもあるけど、 case ラベルを見れば大まかなところはわかると思います。 オペランド二つが数値の場合は TWO_DOUBLES で数値比較、 文字列もしくは数値文字列が二つの場合は TWO_STRING かSTRING_AND_STRNUM で文字列比較 (strcmp)。 そのほかの場合も適当に判断していずれかに。

話がちょっと前後しますが、mawk の場合のデータ型はおおむねこんな感じ。 「データ型」とはちょっと外れてるというのもありますがそこはそれ。

type.h
/*  CELL  types  */

#define  C_NOINIT                0
#define  C_DOUBLE                1
#define  C_STRING                2
#define  C_STRNUM                3
#define  C_MBSTRN                4  /*could be STRNUM, has not been checked */
#define  C_RE                    5
#define  C_SPACE                 6  /* split on space */
#define  C_SNULL                 7  /* split on the empty string  */
#define  C_REPL                  8  /* a replacement string   '\&' changed to &  */
#define  C_REPLV                 9  /* a vector replacement -- broken on &  */
#define  NUM_CELL_TYPES         10

gawk はこう。mawk とはちょっと違いますね。ビットごとに意味を持たせたりしていますし。

gawk awk.h
	NODETYPE type;
	unsigned short flags;
#		define	MALLOC	1	/* can be free'd */
#		define	TEMP	2	/* should be free'd */
#		define	PERM	4	/* can't be free'd */
#		define	STRING	8	/* assigned as string */
#		define	STRCUR	16	/* string value is current */
#		define	NUMCUR	32	/* numeric value is current */
#		define	NUMBER	64	/* assigned as number */
#		define	MAYBE_NUM 128	/* user input: if NUMERIC then
					 * a NUMBER */
#		define	ARRAYMAXED 256	/* array is at max size */
#		define	FUNC	512	/* this parameter is really a
					 * function name; see awkgram.y */
#		define	FIELD	1024	/* this is a field */
#		define	INTLSTR	2048	/* use localized version */
#ifdef MBS_SUPPORT
#		define	WSTRCUR	4096	/* wide str value is current */
#endif
} NODE;

んで、肝心の置換部分。

bi_funct.c
/**********************************************
 sub() and gsub()
 **********************************************/

/* entry:  sp[0] = address of CELL to sub on
	   sp[-1] = substitution CELL
	   sp[-2] = regular expression to match
*/

CELL *
bi_sub(sp)
   register CELL *sp ;
{
   CELL *cp ;			 /* pointer to the replacement target */
   CELL tc ;			 /* build the new string here */
   CELL sc ;			 /* copy of the target CELL */
   char *front, *middle, *back ; /* pieces */
   unsigned front_len, middle_len, back_len ;

   sp -= 2 ;
   if (sp->type != C_RE)  cast_to_RE(sp) ;
   if (sp[1].type != C_REPL && sp[1].type != C_REPLV)
      cast_to_REPL(sp + 1) ;
   cp = (CELL *) (sp + 2)->ptr ;
   /* make a copy of the target, because we won't change anything
     including type unless the match works */
   cellcpy(&sc, cp) ;
   if (sc.type < C_STRING)  cast1_to_s(&sc) ;
   front = string(&sc)->str ;

   if (middle = REmatch(front, sp->ptr, &middle_len))
   {
	   if (middle < front) {
                   /* fprintf(stderr, "middle < front\n"); */
                   front_len = 0;
	   }
	   else {
		  front_len = middle - front ;
	   }
      back = middle + middle_len ;
      back_len = string(&sc)->len - front_len - middle_len ;
	  if (back_len > INT_MAX)
		  back_len = 0;

      if ((sp + 1)->type == C_REPLV)
      {
	 STRING *sval = new_STRING0(middle_len) ;

	 memcpy(sval->str, middle, middle_len) ;
	 replv_to_repl(sp + 1, sval) ;
	 free_STRING(sval) ;
      }

      tc.type = C_STRING ;
      tc.ptr = (PTR) new_STRING0(
			front_len + string(sp + 1)->len + back_len) ;

      {
	 char *p = string(&tc)->str ;

	 if (front_len)
	 {
	    memcpy(p, front, front_len) ;
	    p += front_len ;
	 }
	 if (string(sp + 1)->len)
	 {
	    memcpy(p, string(sp + 1)->str, string(sp + 1)->len) ;
	    p += string(sp + 1)->len ;
	 }
	 if (back_len)	memcpy(p, back, back_len) ;
      }

      slow_cell_assign(cp, &tc) ;

      free_STRING(string(&tc)) ;
   }

   free_STRING(string(&sc)) ;
   repl_destroy(sp + 1) ;
   sp->type = C_DOUBLE ;
   sp->dval = middle != (char *) 0 ? 1.0 : 0.0 ;
   return sp ;
}

tc.type = C_STRING ; ってやってるから、属性は文字列確定だと。 でも置換元が C_STRNUM 属性だったら反映してやる必要がある?

んで、gawk。

eval.c
/* cmp_nodes --- compare two nodes, returning negative, 0, positive */

int
cmp_nodes(register NODE *t1, register NODE *t2)
{
	register int ret;
	register size_t len1, len2;
	register int l;
	int ldiff;

	if (t1 == t2)
		return 0;
	if (t1->flags & MAYBE_NUM)
		(void) force_number(t1);
	if (t2->flags & MAYBE_NUM)
		(void) force_number(t2);
	if ((t1->flags & NUMBER) && (t2->flags & NUMBER)) {
		if (t1->numbr == t2->numbr)
			return 0;
		/* don't subtract, in case one or both are infinite */
		else if (t1->numbr < t2->numbr)
			return -1;
		else
			return 1;
	}
	(void) force_string(t1);
	(void) force_string(t2);
	len1 = t1->stlen;
	len2 = t2->stlen;
	ldiff = len1 - len2;
	if (len1 == 0 || len2 == 0)
		return ldiff;
	l = (ldiff <= 0 ? len1 : len2);
	if (IGNORECASE) {
		const unsigned char *cp1 = (const unsigned char *) t1->stptr;
		const unsigned char *cp2 = (const unsigned char *) t2->stptr;

#ifdef MBS_SUPPORT
		if (gawk_mb_cur_max > 1) {
			mbstate_t mbs;
			memset(&mbs, 0, sizeof(mbstate_t));
			ret = strncasecmpmbs((const char *) cp1, mbs,
					     (const char *) cp2, mbs, l);
		} else
#endif
		/* Could use tolower() here; see discussion above. */
		for (ret = 0; l-- > 0 && ret == 0; cp1++, cp2++)
			ret = casetable[*cp1] - casetable[*cp2];
	} else
		ret = memcmp(t1->stptr, t2->stptr, l);
	return (ret == 0 ? ldiff : ret);
}

続く。かは未定。

■_二択?

C++相談室 part75 
11 デフォルトの名無しさん [sage] 2009/11/28(土) 17:01:08 ID: Be:
     ttp://codepad.org/UcVzc48I

    このコードにて
    20行目と21行目が、どうしてClassDと表示されないのですか? 

12 デフォルトの名無しさん [sage] 2009/11/28(土) 17:15:32 ID: Be:
    >>11を調べていたら、こんなの見つけた。
    関係ないだろうけど面白かった。
    ////////////////////////////////////////////////////////
    CやC++において、演算子の結合は、優先順位ではなく(各々の標準規格での)文法によって定められている。
    このため、微妙な差異が生じる場合がある。たとえば、Cの条件演算子は以下のように定義されている。

    logical-OR-expression ? expression : conditional-expression
    一方、C++では次のように定義されている。

    logical-or-expression ? expression : assignment-expression
    そのため、

    e = a ? b : c = d
    という式は、Cだと

    e = ((a ? b : c) = d)
    と解釈されて条件演算子の結果が左辺値でないことによるエラーとなるが、C++だと

    e = (a ? b : (c = d))
    と解釈され、正しい式となる。

13 デフォルトの名無しさん [sage] 2009/11/28(土) 17:16:39 ID: Be:
    条件演算子(?:)って同じ型しか返せないんじゃなかったかな。
    だから classD も classB に暗黙に変換される。 

14 デフォルトの名無しさん [] 2009/11/28(土) 17:16:40 ID: Be:
    あとJIS的には条件演算子じゃなくて
    二択条件演算子
    っていうんだね。 

16 11 [sage] 2009/11/28(土) 17:25:12 ID: Be:
    ありがとうございます。
     ttp://codepad.org/869c7q1b
    こうしてみたらClassYが多くなりました。
    現在JIS規格を眺めておりますが
    複雑な事が書かれています。

18 11 [sage] 2009/11/28(土) 17:40:21 ID: Be:
     ttp://codepad.org/XACh4bms
    両方を暗黙の型変換可能にするとコンパイルエラーになるようですね。

二択条件演算子ねえ。確かにより正確にどういう操作をするのか表しているとは思うけど。

■_ Perlの

ふむ。


Perlのこれだけは勘弁!というところ - use GFx::WebLog;
Perlのこれだけは勘弁!というところを挙げてみる。

    * scalar context/list contextの区別はいらない
          o void/non-voidだけでよかった
    * メソッド呼び出しと関数呼び出しを区別できない
    * 名前付き引数がないのはDISられてもしかたがない
    * 組み込みのinstanceof演算子相当が存在しない
          o Scalar::Util::blessed($_) && $_->isa(...) は長すぎる

こんなところか。あまり思いつかなかった。他にも欠点がないわけではないのだが,利点と紙一
重だったりライブラリで補えたりすることがほとんどだ。

たとえば,巷で言われるような「後付けOO機能」は欠点とは思わない。組み込みのOO機能が貧弱
だからこそ生まれたものもたくさんあるからだ。

リストコンテキストとスカラーコンテキストの違いは割りと好きだけどなあ。 後ろ三つは…どうなんだろう。 確かに欠点といえるのかもしれないけど設計された時期とか考えるとなあ。

■_ 本日の巡回から

【まるで】使えない新人 0x1C 
405 仕様書無しさん [sage] 2009/11/28(土) 19:25:33 ID: Be:
    仕事サボってTwitterしてる先輩がいます。あんまり仕事がはやい人じゃないのに、ますます遅くなって迷惑なんだよな。 

406 仕様書無しさん [sage] 2009/11/28(土) 21:19:50 ID: Be:
    おめーがtwitter経由で諭してやればいいだろ 

うひ。

2009年11月27日

■_

和解
槇原敬之、松本零士氏との和解が成立 - 芸能 - SANSPO.COM ふみゅ。ところで松本氏は例の「時間は夢を~」の台詞を商標登録したとか。 まあ Star Trek のアレ(Space, the final frontier ・・・) も商標登録されてるしなあ。

■_ 0

Python の話なんですが

Pythonについて(アンチ専用)
562 デフォルトの名無しさん [] 2009/11/03(火) 20:47:51 ID: Be:
    インデント記法は慣れれば気にならないし、
    xx.lenghがなくてlen(xx)に統一されてるのも
    個人的には嫌いだけど一理あるとは認めざる得ない。

    でもスライスのx[n:m]の範囲指定は気持ち悪い。
    なんか合理的な理由でもあるの?

563 デフォルトの名無しさん [sage] 2009/11/03(火) 20:52:51 ID: Be:
    他にどんな方法があるの? 

564 デフォルトの名無しさん [sage] 2009/11/03(火) 21:37:23 ID: Be:
    >>562
    日本語の勉強してから出直せ 

565 デフォルトの名無しさん [sage] 2009/11/03(火) 21:38:46 ID: Be:
    >>563
    [n:m] が n~(m-1) が気持ち悪いっていう意味だろうと E.S.P.

    漏れは合理的だと思うけどね 

566 デフォルトの名無しさん [] 2009/11/03(火) 21:47:04 ID: Be:
    >>565
    ああそういう意味か
    漏れも>>562が何言ってるのか判らんかった

    例えばx文字目からy文字(文字数)取り出すとき
    s[x:x+y-1]
    とするよりも
    s[x:x+y]
    の方が計算が少なくて済むし

    逆にpythonの中の人も
    s[x:y]
    が与えられたときに長さが
    y-x+1
    じゃなくて
    y-x
    となってここも計算が少なくて済む

    小学生でも判るレベルの話 

567 デフォルトの名無しさん [sage] 2009/11/03(火) 21:58:48 ID: Be:
    x文字目からy文字目まで取り出すとき
    s[x:y+1]と計算が多くて済むから合理的 

568 デフォルトの名無しさん [] 2009/11/03(火) 22:31:58 ID: Be:
    x文字目から最後の文字からn文字前まで取り出すとき
    s[x:-n]と計算が少なくて済むから合理的

    >>> 'abcde'[2:]
    'cde'
    >>> 'abcde'[2:-1]
    'cd'
    >>> 'abcde'[2:-2]
    'c'

569 デフォルトの名無しさん [] 2009/11/03(火) 22:33:52 ID: Be:
    s = 'abcde'
    s[2:len(s)]
    s[2:len(s)-1]
    s[2:len(s)-2] 

-1 が最後の要素の添え字なのはいいのですが、範囲で指定する場合には 「その次の値」を与えるので

>>> l = range(1,11)
>>> l
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> l[:]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> l[:] = range(11,21)
>>> l
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
>>> l[0:] = range(11,21)
>>> l
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
>>> l[0:0] = range(11,21)
>>> l
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
>>> l = range(0,10)
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> l[0] = 100
>>> l
[100, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> l[-1] = 99
>>> l
[100, 1, 2, 3, 4, 5, 6, 7, 8, 99]
>>> l[1:4] = [21, 22, 23]
>>> l
[100, 21, 22, 23, 4, 5, 6, 7, 8, 99]
>>> l[0:] = range(21,31)
>>> l
[21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
>>> l[:] = range(31,41)
>>> l
[31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
>>> l[0:-1] = range(31,41)
>>> l
[31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40]
>>> l[0:0] = range(41,51)
>>> l
[41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40]
>>>

ちょっと悲しいことに。確かに [:] (もしくは [0:])と書けばリスト全体が指定できますが、 そうすると、リスト全体のときとそうでないときとで書き分けなければならないですよね。 なんかちょっと悔しいw Inf のようなものがあって、[0:Inf]とかできればいいのだろうか。

まあ今更なネタですね。はい。

■_ i

クラス名・変数名に迷ったら書き込むスレ。Part15
19 デフォルトの名無しさん [sage] 2009/06/15(月) 19:27:55 ID: Be:
    くだらない質問ですいません
    javaの変数のネーミングに関する記事を読んでいたのですが、↓と書いていました
    >ループカウンタに"i"、"j"、"k"を使うのは、C言語などからの習慣です。
    これを信じてもいいのでしょうか? 

20 デフォルトの名無しさん [sage] 2009/06/15(月) 20:14:05 ID: Be:
    見当違いですが必ずしも間違っているわけでもないので信じてもいいと思います。 

21 デフォルトの名無しさん [sage] 2009/06/15(月) 20:23:59 ID: Be:
    見当違いじゃないし 

22 デフォルトの名無しさん [sage] 2009/06/15(月) 20:33:42 ID: Be:
    見当違いというよりスレ違いです 

23 デフォルトの名無しさん [sage] 2009/06/15(月) 20:51:17 ID: Be:
    >>20-21
    ありがとう 

24 デフォルトの名無しさん [sage] 2009/06/15(月) 22:05:03 ID: Be:
    数学からだろwwwww 

25 デフォルトの名無しさん [sage] 2009/06/15(月) 22:28:11 ID: Be:
    fortranではi j k l m nで始まる変数が暗黙のうちに整数型になる
    だからループカウンタでよく使うんだよ。その流れかな 

26 デフォルトの名無しさん [sage] 2009/06/15(月) 22:56:56 ID: Be:
    すぐリファクタリングしちゃうんで、最近めったにkまで使わなくなったな 

27 デフォルトの名無しさん [sage] 2009/06/16(火) 01:11:25 ID: Be:
    数学で整数の変数名にi,j,k,l,m,nを使ってた
            ↓
    世界初のプログラミング言語FORTRANは数式処理を目的に開発されたので
    数学に習ってI,J,K,L,M,Nは暗黙的に整数型として扱われるようにした
    当然、ループカウンタにもそれらを使う習慣ができた
            ↓
    後発の言語でもループカウンタにi,j,kなどを使うのが習慣化した

    って流れだっけ? 

30 デフォルトの名無しさん [sage] 2009/06/16(火) 04:13:40 ID: Be:
    それとIntegerのiという嘘ネタの方も仕入れとけばおk 

31 デフォルトの名無しさん [sage] 2009/06/16(火) 09:34:26 ID: Be:
    どうせなら、Iterationも宜しく。 

32 デフォルトの名無しさん [sage] 2009/06/16(火) 09:58:01 ID: Be:
    元々はindexのiだっけ? 

33 デフォルトの名無しさん [sage] 2009/06/16(火) 10:03:27 ID: Be:
    流石にそれは無い 

34 デフォルトの名無しさん [sage] 2009/06/16(火) 10:18:52 ID: Be:
    ι = iota の i ってのも聞いたな。 

35 デフォルトの名無しさん [sage] 2009/06/16(火) 10:19:07 ID: Be:
    >33
    じゃあ正解は何? 

ほんと正解は何なんでしょうか。

■_ back reference

またもム板からですみません。

正規表現 Part6 
615 デフォルトの名無しさん [] 2009/11/27(金) 11:50:16 ID: Be:
    ●正規表現の使用環境
    perl5

    ●検索か置換か?
    検索

    ●説明
    クォーテーションに囲まれた(省略可)の文字列を取得したい。

    ●対象データ
    "aaa":'bbb':`ccc`:ddd:eee:666:777:888:999:000:111

    ●希望する結果
    $1:aaa
    $2:bbb
    $3:ccc
    $4:ddd
    $5:eee
    $6:666
    $7:777
    $8:888
    $9:999
    $10:000
    $11:111

    (["'`]*)([^\1]*)\1):(["'`]*)([^\2]*)\2):(["'`]*)([^\2]*)\2)の形式で、
    後方参照が一桁の時はうまく行くんですが、二桁になると不具合がおきます。

    (["'`]*)([^\10]*)\10)
    \10の下一桁に該当する文字(0)があるとマッチしません。
    原因は[^\10]の部分が「\10以外」ではなく「\1と0以外」と解釈される為では
    ないかと思いますが、回避する記述方法はありますか?。 

616 デフォルトの名無しさん [] 2009/11/27(金) 12:02:52 ID: Be:
    失礼しました。

    (["'`]?)([^\1]*)\1:(["'`]?)([^\3]*)\3:(["'`]?)([^\5]*)\5
    (["'`]?)([^\11]*)\11)

    $2:aaa
    $4:bbb
    $6:ccc
    $8:ddd
    $10:eee
    $12:666
    $14:777
    $16:888
    $18:999
    $20:000
    $22:111

    でしたm(__)m。 

617 デフォルトの名無しさん [sage] 2009/11/27(金) 13:26:38 ID: Be:
    そもそも文字クラス中で\1とかは使えない罠。
    [^\1]は文字コードが1の文字以外に解釈されて
    いると思われる。

    print "match1\n" if 'aa' =~ /(.)[^\1]/;
    print "match2\n" if "a\001" =~ /(.)[^\1]/;
    print "match3\n" if 'ab' =~ /(.)[^\1]/; 

618 デフォルトの名無しさん [] 2009/11/27(金) 13:49:45 ID: Be:
    1と3だけマッチしますね。「(後方参照としての)\1と0以外」と
    解釈される為でも無いということですね。

    確かに下一桁が該当する場合に必ず一致しないということでも
    なかったので、原因がわからず苦しんでました。ありがとうございます。

    ^を使用して簡潔に「(二桁で指定する)後方参照の文字を含まない
    文字列」は表現できないものでしょうか。 

619 デフォルトの名無しさん [] 2009/11/27(金) 14:47:01 ID: Be:
    クラスの中で使えないということは^で「以外」を
    表現することも出来ないということですね…。

    perl5なんで(?!regexp) が使えるのかな。

620 デフォルトの名無しさん [sage] 2009/11/27(金) 15:01:37 ID: Be:
    クォーテーションに使った文字以外と書きたくなるのはわかるが、
    正規表現では書きにくいので最小マッチ.*?でいいんじゃね? 

621 デフォルトの名無しさん [] 2009/11/27(金) 15:16:04 ID: Be:
    最小マッチだと文字間の区切り記号「:」を含む文字列を指定できないんです。
    説明不足でした。

    ●対象データ
    "aaa":bbb:"c:c"

    ●希望する結果
    変数1「aaa」
    変数2「bbb」
    変数3「c:c」
    としてマッチさせたいんですが…。 

なんでこう「オレ様(の思い込み)仕様」が後を絶たないのか。 良くあるのは [^(foo)]* で foo を含まない繰り返しとか(最近もmixiで見かけた)。 615 にある 後方参照が一桁の時はうまく行くんですが、二桁になると不具合がおきます というのは、二桁以上になると八進表記のキャラクターコード指定と解釈されるからでしょうね。 確かに十個以上の back reference を扱えるものはあるし、Perlもそのひとつなんですが それは $nn 表記を使ったときの話なんですよね(以前のPythonでは \vnn というのがありました)。 ただ、置換の lhs とか検索のパターンで \1 \2 の代わりに $1 $2 と書いていいかというと…

あれ、Perl だと \{nn} とかできた?

■_本日の巡回から

■_ ペースが上がらん

いろいろ面白そうなのは日々見つかるんですが。

What a Monad is not - HaskellWiki

What a Monad is not

Contents

    * 1 Warning
    * 2 Monads are not a good choice as topic for your first Haskell blog entry
    * 3 Monads are not a language feature
    * 4 Haskell doesn't need Monads
    * 5 Monads are not impure
    * 6 Monads are not about state
    * 7 Monads are not about strictness
    * 8 Monads are not values
    * 9 Monads are not a replacement for applicative functors
    * 10 Monads are not about ordering

(以下略)

State of Ruby VMs: Ruby Renaissance - igvita.com

State of Ruby VMs: Ruby Renaissance

Ruby is commonly associated with the frameworks (Rails, RSpec, and many others) that 
it enabled, but it is much more then that. The same ideology and design principles 
that popularized the language at the start are also the reason why it is being 
currently ported to a variety of alternative platforms: JVM, Objective-C, Smalltalk VM 
and Microsoft's DLR. Technical details aside, few will disagree that Matz's focus on 
“how we feel while programming” and the objective of “making the programmer happy” 
has resonated with the larger community.

Ruby は (Rails, RSpec, その他もろもろ) フレームワークと結び付けられることが一般的です
が、it is much more then that.開発を始めたときにに言語を popularized した同じイデオロ
ギーとデザインの原則は現時点でJVM, Objective-C, Smalltalk VM and Microsoft's DLR 
といったvariety of alternative platforms に移植されている理由でもあります:
技術的な詳細はさておいて、Matz が “how we feel while programming” にフォーカスして
“making the programmer happy”(“プログラマーを幸福にする”)という目的が大きなコミュ
ニティと resonate (共鳴) したということに反対する人はそれほどいないでしょう。

In a short span of just a couple of years, the Ruby VM space has evolved to more than 
just a handful of choices: MRI, JRuby, IronRuby, MacRuby, Rubinius, MagLev, REE and 
BlueRuby. In fact, keeping up with all of the most recent developments within each VM 
is now easily a full-time job. For that reason, and with RubyConf ‘09 in full swing, 
let's take a quick survey of the space and where it's taking us.

ほんの二、三年という短いスパンではMRI, JRuby, IronRuby, MacRuby, Rubinius, MagLev, REE 
and BlueRuby のように、Ruby VM の space は just a handful of choices という範囲を越え
て広がっています:
In fact, keeping up with all of the most recent developments within each VM 
is now easily a full-time job.
For that reason, and with RubyConf ‘09 in full swing, 
let's take a quick survey of the space and where it's taking us.

2010: Year of Ruby Renaissance (Ruby の Renaissance の年)

(以下略)

2009年11月26日

■_

・ダムエー
ORIGINが…。まあ一回くらいはいいか。 「教えてください富野です」で、ミツバチの大量死に関連した話など。 「クリスマスケーキにイチゴは必須でしょうか?」にはちょっと考えるところが (イチゴの本来の収穫時期とは違う)。

■_ Perl 6

BEGIN/END は awk から引き継いだものだと思うけど、なんかお気に召さない人もいると。 もうひとつある CHECK ってなんじゃ?

blog | Perlgeek.de :: Set Phasers to Stun!
Thu, 26 Nov 2009
Set Phasers to Stun!

Permanent link

Did you ever wonder how BEGIN, CHECK, END and so on are called in Perl? Well, they 
didn't have a good name, until recently.

The Perl 6 spec listed them under closure traits, which is unwieldy, and not really 
exact either. Now they are called phasers, because they tell you which execution phase 
the block or statement runs in.

There are so many possible puns that I'll refrain from writing any.

んでなんか話し合いがもたれたらしく IRC log for #perl6, 2009-11-06

■_ 数学必須?

Programmers should know math.. just not all of it - Invisible to the eye

http://perlcabal.org/svn/pugs/view/docs/Perl6/Spec/S04-control.pod?rev=29004

Friday, October 16, 2009

Programmers should know math.. just not all of it

Mathematics is a part of a programmer's life. Other than the basic concepts 
implemented in programming languages, there are particular topics which are mandatory 
when you enter a field like three-dimensional graphic or financial applications. 
Writing components for these applications often means you have implement a 
mathematical model in code.

数学はプログラマーの人生の一部です。プログラミング言語で実装されているような基本的なコ
ンセプト以外にも三次元グラフィックスや金融アプリケーションのような領域に入ったときに要
求される特定のトピックが存在しています。こういったアプリケーションのためのコンポーネン
トを書くことはしばしば数学的なモデルをコードによって実装することを意味します。

Think of a graphic engine for a video game. If the first thing that comes to your 
minde is it's difficult, you're not alone. It's difficult because the mathematics 
structures and theories behind it are not general knowledge: they are a specific 
algebra topics which many of us do not master. Otherwise, if you see a !($a or $b) 
statement probably you know how to write an equivalent form.

ビデオゲームのためのグラフィックエンジンを考えてみましょう。最初に思い浮かんだことが難
しいものだということだとしてもあなたは孤独ではありません。グラフィックエンジンが難しい
のはその背後にある数学の structures と理論が general knowledge ではなく、わたしたちの
多くがマスターしていない代数のトピックだからなのです。
もしこれを知っていなくても !($a or $b) という文 (statement) を見たときに、
等価な form をどのように書くのかについておそらくあなたは知っていることでしょう。


So how can you learn all this stuff?
(じゃあどうやれば all this stuff を学べるのだろうか?)

The programming field is broader than ever, and there are more and more mathematics 
instruments used in computing. A modern programmer should be a jack-of-all-trades in 
his mathematical side, as he should learn the majority of the specific disciplines as 
needed by his profession, while mastering the foundations which he encounters every 
day.

プログラミングの領域 (programming field) は以前よりも幅広いものになっていて、コンピュ
ーティングにおいてはますます数学の insutruments が使われるようになってきています。
modern なプログラマーは日々遭遇する foundations をマスターする自分の mathematical side 
において自分の profession により必要とされる specific disciplines  の majority を学ん
だほうが良いような jack-of-all-trades (万能選手?) になるべきです

I have made a breakdown of the main arguments taught in high school and university 
which are utilized in computer science. I divided this list in a basic section and 
specific applications one.

わたしは、コンピューター科学に utilized した高校や大学で教えられていた
main arguments をブレークダウンしました。
わたしはこのリストを basic section なものと specific applications なものとに分けました。

Basic list (what you should certainly know):
ベーシックリスト (あなたが確実に知っておくべきこと)

    * Set theory and relations: used in the relational model without most people knowing,
      and also as terminology in modern languages (List vs. Set).
      集合論とrelations (関係?):
      ほとんどの人が知らないうちに relational model を使っています。また、modern なプログラ
      ミング言語における用語 (terminology) としても使われています (List vs. Set)。

    * Functions: there is a resemblance in mathematical functions and programming ones. 
      Functional programming is an approach coherent and taken to the extreme. The lack of 
      side effects is another strong similarity.
      関数:
      数学で言うところの関数とプログラミングで言うそれとは似ているところがあります。関数プロ
      グラミングは coherent な approach であり、 taken to the extreme です。
      副作用の欠如はもう一つの strong similarity です。

    * First order logic: De Morgan laws are a powerful example of refactoring applied 
      to if statements. A strong foundation for something you will write forever: 
      conditional expressions.

      First order logic:
      ド・モルガンの法則 (De Morgan laws) は if 文に対して適用するリファクタリングのための
      poweful example です。conditional expressions (条件式) というあなたが永久に書くことに
      なるだろうもののの強力な基礎です。

    * Differential and integral calculus (in one variable): they are general knowledge. 
      Handy when dealing with disparate problems, for example maximums and minimums of an 
      expression.

      微積分 (一変数のもの):
      これらは general knowledge です。たとえばある式の最大値や最小値を求めるといった
      disparate problems (共通点のない問題?) を扱うときに便利なものです

    * Enumerative combinatorics: scary name for permutations and combinations. 
      Counting items is a recurring task.

      Enumerative combinatorics:
      順列と組み合わせに対する scary name です。
      アイテムの counting は  recurring task です。

    * Computational complexity: to know when an algorithm performs better than another.
      Computational complexity (計算複雑性?):
      あるアルゴリズムが別のものよりも優れている場合を知るために。

Specific applications of mathematics (what you can learn as needed):
(必要に応じて学べるもの)

    * Trigonometry: you can take advantage of trigonometric functions while solving 
      geometric and 2d graphics problems.

      三角法:
      幾何や二次元グラフィックスの問題を解くのに三角関数の advantage を活かすことができます。


    * Analytic geometry and linear algebra: a fundamental in 3d graphics. Rotating an 
      object involves matrix multiplications.

      解析幾何学と線形代数:
      三次元グラフィックスにおける基礎です。オブジェクトのローテートには matrix の操作が必要に
      なります。

    * Abstract algebra: groups, rings, fields and so on. These are structures which are
      used to solve very specific problems. For instance, you can solve the Rubik's Cube 
      with enough group theory.

      抽象代数:
      群、環、体などなど。これらは非常に specific な問題を解くために使う構造です。たとえば
      ルービックキューブは群論でもって解くことが可能です。

    * Vector and multivariable calculus: also useful in anything that involves manipulation
      or simulation of physical objects. The law of physics you want to simulate are
      formulated in these terms. Though, these are engineering concepts instead of general
      computer science ones.

      ベクトルと multivariable calculus:
      物理オブジェクト (physical objects) の操作やシミュレーションをするのを必要とする
      何かに対して便利でもあります。あなたがシミュレートしたいと思っている物理法則は
      これに関する用語を使って formlated されています。

Though, these are engineering concepts instead of general computer science ones.

    * Statistic and probability theory: the world is not deterministic and some models 
      should take into account natural variability of the data they act upon.

      統計と確率論:
      世界は deterministic なものではなく、
and some models should take into account natural variability of the data they act upon.
いくつかのモデルは

    * Complex numbers: probably useful only if you are treating signals and dynamic 
      systems.
      複素数: 信号や dynamic systems を扱う場合にのみ役に立つでしょう。

    * Financial mathematics: interests and present values are not a simple topic as they can seem.
      金融数学?:
      interests and present values are not a simple topic as they can seem.

When dealing with problems in a domain as the financial one, the fundamental 
principles must be mastered to produce a reliable and useful model. This is true for 
nearly every kind of business domain. Maybe in the future you will work on airports 
and flights, or restaurants reservations and lines. Take the time to learn the 
mathematics to model these domains.

finacial なものとしてある領域に属する問題を取り扱うとき、reliable かつ useful なモデル
を作り出すために基本的な原則はマスターしておかなければなりません。これはほぼすべてのビ
ジネスドメインに対しても同じことです。将来、あなたは空港でフライトを扱う仕事をするかも
しれないしあるいはレストランの予約(と lines)を扱うことがあるかもしれません。
これらの領域をモデル化するために数学を学ぶ時間を確保しましょう。

The image at the top is a standard Rubik's Cube. Can you solve it? It is a pure 
mathematical problem, the time for studying it is the only requirement. People who 
master the math behind it can solve the problem in a few minutes (and often less).

トップにある画像は標準的なルービックキューブです。あなたはこれを解けますか? ルービック
キューブは純粋に数学的な問題で、それを学ぶ時間だけが要求されます。背後に隠れている数学
をマスターしている人であればこの問題を数分(しばしばそれ未満で)で解くことができるでしょ
う。

Published by Giorgio at 10/16/2009 12:59:00 PM

圏論が挙がってないな(笑) まあ抽象代数に含まれるんだろうけど。

■_ 本日の巡回から

■_

名古屋コルーチン?

Go part3 
229 デフォルトの名無しさん [sage] 2009/11/26(木) 15:41:35 ID: Be:
    コルーチンと名古屋コーチンって似てるよね
    そんな私の昼飯は親子丼でした 

230 デフォルトの名無しさん [sage] 2009/11/26(木) 15:44:40 ID: Be:
    >>229
    誰が上手いことを言えと 

231 デフォルトの名無しさん [sage] 2009/11/26(木) 15:44:51 ID: Be:
    >>229
    はもっと評価されるべき 

232 デフォルトの名無しさん [sage] 2009/11/26(木) 15:46:38 ID: Be:
    >>229
    すごいこれはガイドライン板にスレが立ってもいいレベル 

233 デフォルトの名無しさん [sage] 2009/11/26(木) 16:08:04 ID: Be:
    俺が昔C言語でgoroutineみたいなものを書いたとき、
    「そういうアルゴリズムは知ってるけど、実際に使うことはないよね・・・」
    と言われたのを今でも思い出す。
    当時は無印Pentium時代でマルチコアなんて誰も知らない時代だったから仕方ないけど、
    俺はスレッドには無駄が多すぎることを知っていたから作っただけなんだ。
    あのころに俺自身がもっと自分に自信を持っていればよかったのに・・・ 

234 デフォルトの名無しさん [sage] 2009/11/26(木) 16:16:29 ID: Be:
    >>229
    二行目が上手すぎるw
    今年一番ワロタwww 

235 デフォルトの名無しさん [sage] 2009/11/26(木) 16:19:18 ID: Be:
    何というタイムリーなネタを・・・ 

236 デフォルトの名無しさん [] 2009/11/26(木) 19:19:31 ID: Be:
    >>233
    今自信を持ちなおせばいいだけでは 

237 デフォルトの名無しさん [sage] 2009/11/26(木) 19:20:22 ID: Be:
    コルーチン(やマイクロスレッドやファイバ)はyieldとかで明示的にコンテキストを切り替えるやつだと思ってたんだけど
    並列実行されるのもコルーチンっていうんだ? 

238 デフォルトの名無しさん [sage] 2009/11/26(木) 19:41:12 ID: Be:
    言わない気がする
    ゴルーチンはダジャレだろ 

239 デフォルトの名無しさん [sage] 2009/11/26(木) 19:41:32 ID: Be:
    >>236
    もうだめだ。
    俺は自分で自分の才能の芽を摘んでしまった。
    一生ドカタで終わり。さようなら。 

240 デフォルトの名無しさん [sage] 2009/11/26(木) 19:53:35 ID: Be:
    >>238
    だよな。
    というか、goroutine 以外見どころがない 

241 デフォルトの名無しさん [sage] 2009/11/26(木) 20:40:34 ID: Be:
    >>239
    気を落とすな
    累計で言えば数十万人の無名プログラマーが同じものを作ったことがあるだろう
    パッケージングとアナウンスが重要なんだ 

242 デフォルトの名無しさん [sage] 2009/11/26(木) 20:42:59 ID: Be:
    >>241
    そうだよ。
    まぁ、要はマーケティングなんだよね。
    でも、それに価値があるかどうかを確信が持てないとマーケティングなんかできないよね。
    俺には意志力がなかったんだ。 

243 デフォルトの名無しさん [sage] 2009/11/26(木) 20:45:16 ID: Be:
    価値がなかったんだろ 

244 デフォルトの名無しさん [sage] 2009/11/26(木) 20:46:00 ID: Be:
    >>242
    マーケティングってそういう意味じゃないよw

    まあそれは置いといて、疑似スレッドなんてゲーム業界じゃ当たり前でやってたでしょ
    C言語でライブラリ化なんて全然珍しいことじゃないから・・・ 

245 デフォルトの名無しさん [sage] 2009/11/26(木) 20:46:24 ID: Be:
    よくよく考えてみると、あの時俺を痛烈に批判した奴が要所要所で
    俺の意欲を効果的に削いでいったことは間違いない。
    結局、人間が大成するかどうかは良い人間に出会えるかどうかなんだなぁと思った。
    そう考えると大成した人間はラッキーなんだろうな。 

246 デフォルトの名無しさん [sage] 2009/11/26(木) 20:48:34 ID: Be:
    >>244
    マーケティングじゃん。
    市場を調査してほしい人の目の前にぶら下げること。
    パッケージングしてアナウンスっていうのは要するに使いやすい状態にしてどうぞ使ってくださいね、って宣伝することでしょ。 

247 デフォルトの名無しさん [sage] 2009/11/26(木) 20:50:49 ID: Be:
    >>244
    それは後で知ったことだし、ゲーム業界以外ではあんまり有名ではなかった。
    そのころ俺はメインフレームの開発に携わっていたから。 

248 デフォルトの名無しさん [sage] 2009/11/26(木) 20:52:12 ID: Be:
    >>246
    市場調査・・・によって生まれたかなあこれ
    むしろ自分のニーズに対して忠実にやってるだけのような感じするけど 

251 デフォルトの名無しさん [sage] 2009/11/26(木) 21:00:57 ID: Be:
    マーケティングによって生まれる新しい言語を想像してみる。
    PHP+VBのGUIデザイナ、DB接続が楽とかそんなんだろうな。 

253 デフォルトの名無しさん [] 2009/11/26(木) 21:05:39 ID: Be:
    C#とかはマーケティングによってできた言語でしょ 

254 デフォルトの名無しさん [sage] 2009/11/26(木) 21:06:59 ID: Be:
    研究だって広い意味ではマーケティングだよ。
    誰かが必要としているから研究するのだから。 

255 デフォルトの名無しさん [sage] 2009/11/26(木) 21:08:16 ID: Be:
    「広い意味」とか言い出したらどうにもなんないだろw 

256 デフォルトの名無しさん [] 2009/11/26(木) 21:09:55 ID: Be:
    『誰か』が自分たちだけっていう 

257 デフォルトの名無しさん [sage] 2009/11/26(木) 21:10:51 ID: Be:
    >>252
    それをやっちまうとそこからは新しいものは何も生まれないとかなんとか、
    そんな感じだったか?
    もう2chから新しいものは何も生まれないのか。 

258 デフォルトの名無しさん [sage] 2009/11/26(木) 21:12:53 ID: Be:
    かつてのプログラミングオタクももう新言語覚えるのがおっくうになって雑談ばっかりだな 

推薦図書/必読書のためのスレッド 52 
978 デフォルトの名無しさん [sage] 2009/11/25(水) 20:10:29 ID: Be:
    C言語を覚えたので、C++を覚えようと思います。お勧め書籍がありましたらご教授ください
    書籍の内容は、機能ごとに機能、メリット、デメリット、注意点を短く的確に書いてあり、
    書籍の厚みも薄いものが望ましいです。日本語で書かれている必要もあります。価格は問いません 

979 デフォルトの名無しさん [] 2009/11/25(水) 20:13:47 ID: Be:
    やさしいC++ 第3版 

980 デフォルトの名無しさん [sage] 2009/11/25(水) 20:19:27 ID: Be:
    ビューティフルアーキテクチャ買ってきた。
    まだ読んでない。 

981 デフォルトの名無しさん [sage] 2009/11/25(水) 21:04:12 ID: Be:
    プログラミング言語C++おすすめ 

982 デフォルトの名無しさん [sage] 2009/11/25(水) 21:13:48 ID: Be:
    それならacceralated C++ 

983 デフォルトの名無しさん [sage] 2009/11/25(水) 21:17:51 ID: Be:
    Eiffelオブジェクト指向入門 

984 デフォルトの名無しさん [sage] 2009/11/25(水) 21:20:54 ID: Be:
    ロベール 

985 デフォルトの名無しさん [sage] 2009/11/25(水) 21:46:25 ID: Be:
    ロベールの翻訳は分かりやすい 

986 デフォルトの名無しさん [sage] 2009/11/25(水) 21:46:44 ID: Be:
    C++プライマー 

987 デフォルトの名無しさん [sage] 2009/11/25(水) 21:48:37 ID: Be:
    やはり厚い本を言う流れになったかw 

988 デフォルトの名無しさん [sage] 2009/11/25(水) 21:53:07 ID: Be:
    実際、分厚い本にあるような知識がないとC++を使いこなせない 

989 デフォルトの名無しさん [sage] 2009/11/25(水) 22:01:16 ID: Be:
    おすすめはAccelerated C++かな。
    スマートポインタのような必須の知識をやさしく教えてくれる
    教科書は他にはなかなかないんで。
    ただし、この本は2部構成で教科書としての価値があるのは第8章から。
    それまではカスみたいな内容なので注意。 

993 デフォルトの名無しさん [sage] 2009/11/25(水) 23:13:14 ID: Be:
    プログラミング言語C++ 第3版は詳しいけど訳がひどいから読みにくいと思う。
    正誤表がネットにあるからそれを1度見たほうがよい。 

994 939 [sage] 2009/11/25(水) 23:18:51 ID: Be:
    944さん946さん947さんほかみなさんありがとうございました。
    944のURLのものを試してみようと思います。 

995 デフォルトの名無しさん [sage] 2009/11/25(水) 23:28:43 ID: Be:
    >>993
    本国では3.5版が出てるんだったっけか? 

996 デフォルトの名無しさん [sage] 2009/11/26(木) 00:10:57 ID: Be:
    >>995
    それは知らなかったので調べてみたけど、
    The C++ Programming Language: Special Edition (3rd Edition) [Special Edition]
    ってやつか。

997 デフォルトの名無しさん [sage] 2009/11/26(木) 01:24:46 ID: Be:
    Appendiexの追加があるだけで、他の書き換えはないです。
    さらにその追加分も禿のページで読めます。

    洋書読んでいる人は当然知っているだろうけど。
    errataの上に置いてあるので。

998 デフォルトの名無しさん [sage] 2009/11/26(木) 02:09:37 ID: Be:
    世界中のプログラマが熟読するロベール 

999 デフォルトの名無しさん [sage] 2009/11/26(木) 02:52:50 ID: Be:
    Special Editionはハードカバーなんだぜ!
    それだけでも買う価値が!
    …洋書ってなんであんなにボロボロになりやすいんだろうね 

2009年11月25日

■_

買った
ロボットアニメ大鑑 上巻 ロボットアニメ大鑑 下巻 サンライズ ロボットアニメ大鑑
2枚組+2枚組+3枚組 でもまだ足りない(笑) マジンガーZやグレートマジンガー、ゲッターロボがないし、コンバトラーVからダイモスなんかもない。 まあ会社が違うせいなんだろうけど。 でもバルディオスが収録されているのにゴーショーグンがないのがなんともって あれも会社違うんだっけ? あ、ガイキング(古いほうね)とかゴライオン、ダルタニアスやダイラガーXVもか。

トレード
ベイスターズとファイターズで3対3のトレード成立と。 加藤センセイ(本当に教員免許持ってる)は

   / ̄ ̄ ̄ ̄ ̄ ̄\ 
 /             \ 
/                  ヽ 
l:::::::::.                  | 
|::::::::::   (●)     (●)   | 
|:::::::::::::::::   \___/     | 
ヽ::::::::::::::::::::.  \/     ノ 

このAAが大活躍してた頃に孤軍奮闘してたんだよなあ。 中継ぎから抑え、先発と。もっとも抑えはこれというキメ球がないので粘られて以下略 という感じだったし、先発に回ったときも微妙だったなあ。 んで、2006年シーズンに中継ぎ投手のタイトル獲ったと。 北海道にいってもがんばってください。

■_ こめんと

積極的に見ようとしないとコメントがあるかどうかわからにってのはやっぱ問題じゃなかろか。

インテルTBBから学ぶループの並列化(1/4):CodeZine
今回も、間違いは訂正されないようですね・・・時間を空けてみてましたが・・・
CodeZineのコメントは初期段階で非表示なので、記事に間違いがあるかどうかの判断にコメントが使えないんですよねぇ。
せめて、コメント数や評価が表に表示されればいいんですが・・・
CodeZineがモラルの無いライターに対し、指導をしないならば、なんらかの救済処置が欲しいと思いますね。

初心者がわかりやすいサンプルと、初心者が書いたようなサンプルはかなり違うと思います。
わざわざ複雑にされているクラス設計や書式など、本題とは無関係な部分で読み取りにくくなってますね。
意識してそのようにしているとしたら、止めたほうが良いと思います。
実害は無くてもdelete忘れなどは、「Parallel Inspector」の記事が泣くと思いますし(^^;

(以下略)

CodeZine はすぽすっぽ先生のお手紙がどうたらのときも(ぴー)だったしなあ。

■_ 本日の巡回から

■_ 二次ポインタ?

まあ昔、secondary cache を「セカンドキャッシュ」って言ってた人もいたけどねえ。


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

205 デフォルトの名無しさん [sage] 2009/11/23(月) 00:44:20 ID: Be:
    UNICODEがC言語でも処理できるという情報を小耳に挟んで
    朝から昼飯や夕飯も惜しんで葛藤してるものなんですが
    wchar.hのfopen_s関数の使い方がよく判りません。
    特に、fopen_s関数の第一引数がなんで二次ポインターなのか
    教えて頂きたいです。そして、複数のUNICODEにエンコードされた
    ナンバーのついたファイルを効率よくバファリングするのに
    二次ポインターを使った方が後々不備が出ない設計になると思い
    四苦八苦してるところです。つまり、fopen_s関数の第一引数のアクセス権も
    把握しかつ自分の論理的思考によりポインターを細分化していくような労力が必要になります。
    void openstream(int min,int max,char *p1){
    FILE *file[MAXSIZE];
    int i;
    char copy[30];
    char str[30];
    char p2[150];


    errno_t err;copy[0]='\0';str[0]='\0';p2[0]='\0';
    for(i=0;i<(max-min)+1;i++){
    strcpy(p2,p1);
    sprintf(str,"%d",(i+min));
    strcpy(copy,"\\単語");
    strcat(copy,str);
    strcat(copy,".txt");
    strcat(p2,copy);
    if( (err= fopen_s(&fp3[i],p2, "rb,ccs=UNICODE" ))!=0)
    exit(1);
    }
    }
    } 

206 デフォルトの名無しさん [sage] 2009/11/23(月) 00:52:30 ID: Be:
    上記のソースは絶対パスと規則的なナンバーがついた
    UNICODEの単語x.txtファイルを順に開いていくプログラムですが
    fp3のポインターによりそれぞれの定型処理で、ストリームを
    開いていってもFILE型で宣言が無意味なぐらい
    爆発的に伸びる階数のように不規則な動きをします。 

207 デフォルトの名無しさん [sage] 2009/11/23(月) 00:55:20 ID: Be:
    駄文で申しわけありませんが

    ご指南の方をよろしくお願いします 

208 デフォルトの名無しさん [sage] 2009/11/23(月) 01:01:33 ID: Be:
    >>205
    質問の内容についてはよく分かんないけど
    こうしたほうが良くね?

    strcpy(p2,p1);
    sprintf(str,"%d",(i+min));
    strcpy(copy,"\\単語");
    strcat(copy,str);
    strcat(copy,".txt");
    strcat(p2,copy);
    ↓
    sprintf(p2, "%s\\単語%d.txt", p1, (i+min)); 

209 デフォルトの名無しさん [sage] 2009/11/23(月) 01:32:10 ID: Be:
    >>208
    そうした方が見やすいといえば見やすいですね。

    基本的に難しく書こうが、優しい書こうがfopen_s関数の
    第一引数はなぜ二次ポインターになってるいるのか
    謎が深まるばかりです。その理由は、一次ポインターや
    二次ポインターなどマドろこしい理論は置いといて
    fcloseやfflushしても、fopen_sでストリームを
    複数回開くとまるでゴミのようなバファが出力されてきます。
    それは元を辿れば自分がテキストファイルにより出力された物には
    違いありませんが、まるで関数作成者のフラストレーションを
    吐き出すかのようなオナニークラスです。正直データとして扱かえれません。
    ちなみにいい忘れましたが、私の処理系はWINDOWS7で
    Visual Studio 2009を使ってます。私の直感ですが、このfopen_sの
    二次ポインターは関数ポインターで受け渡すか、FILEポインターで引き渡す
    Elmentではないかのどちらかだと思います。いずれにしよ、一つ一つの
    処理単位が違うと感じました。 

210 デフォルトの名無しさん [sage] 2009/11/23(月) 01:38:31 ID: Be:
    戻り値のエラー情報積極的に使えってことだろ。

211 デフォルトの名無しさん [sage] 2009/11/23(月) 01:40:09 ID: Be:
    >>209
    fopen_s(FILE** pFile, ...)になっているのは、そうしないと FILE* の
    変数を更新できないから。

    本当は成否のerrno_tとFILE*の2つの値を返したいけど、Cではそういう
    ことはできないので片方をポインタにしてパラメータに置いている。

212 デフォルトの名無しさん [sage] 2009/11/23(月) 01:40:52 ID: Be:
    つーか、根本的に解ってないんじゃね?
    そう不思議な仕様でもないだろ。
    渡すためじゃなくて受け取るためだからアドレス参照渡しなんだぞ? 

213 デフォルトの名無しさん [sage] 2009/11/23(月) 01:43:19 ID: Be:
    >>205
    関数内で FILE* file[] ってあるのに、fopen_s() に渡しているのは
    fp3[i] だったりしてあやしい。

214 デフォルトの名無しさん [sage] 2009/11/23(月) 03:37:15 ID: Be:
    なんで配列って[0]から始まるんだろう。
    int a[10]ってやったら
    a[10]はないとかわかりづらい。

    [1]からはじまればいいのに。 

215 デフォルトの名無しさん [sage] 2009/11/23(月) 04:13:44 ID: Be:
    満年齢と数え年の違いみたいなもんだ。 

216 デフォルトの名無しさん [sage] 2009/11/23(月) 04:27:40 ID: Be:
    >>214
    それが嫌なら OPTION BASE 1 を指定してVBでも使ってろってこった 

217 デフォルトの名無しさん [sage] 2009/11/23(月) 05:53:27 ID: Be:
    ろくに勉強しないで長い感想文ばっかり書いてる奴は
    そういうのが誉められる世界へ行けよ 

218 デフォルトの名無しさん [sage] 2009/11/23(月) 08:12:31 ID: Be:
    >>213
    すいません。
    if( (err= fopen_s(&fp3[i],p2, "rb,ccs=UNICODE" ))!=0)
    じゃなくて・・・ ↑
    if( (err= fopen_s(&file[i],p2, "rb,ccs=UNICODE" ))!=0)
    ですよ。ソースからコピペする時にミスりました

    テヘ 

219 デフォルトの名無しさん [sage] 2009/11/23(月) 08:25:20 ID: Be:
    >>212
    アドレスの参照渡しですか!!!
    fopen_s()が二次ポインターを要求してるから
    三次ポインターを使えって事ですかw俺はC言語
    仙人じゃないので判りません。ちなみに、マドロこしいの
    嫌いだからFILE *file[MAXSIZE]は2ch転機上は
    openstream()内で宣言してますが
    実際に使うときはグローバル変数で使ってました。
    三次元ポインターとか、敷居の高いことできるなんてさすが
    C言語の世界を極めてた人は違いますね 

220 デフォルトの名無しさん [sage] 2009/11/23(月) 08:59:51 ID: Be:
    うぜえ 

221 デフォルトの名無しさん [sage] 2009/11/23(月) 09:35:57 ID: Be:
    ポインタの敷居が高いと感じるなら適性が無いと言う事。
    早々に見切りをつけて別の道を行った方が良い。 

222 デフォルトの名無しさん [sage] 2009/11/23(月) 09:38:31 ID: Be:
    ポインターなんて
    int x;
    int *p;
    p=&x;

    三次元だろうが参照だろうが全部これをちょっと形変えただけじゃん。 

223 デフォルトの名無しさん [sage] 2009/11/23(月) 09:56:17 ID: Be:
    >>222
    おまえ分かってないだろww 

224 デフォルトの名無しさん [sage] 2009/11/23(月) 11:42:09 ID: Be:
    *p
    pのポインタ

    **p
    pのポインタのポインタ

    ***p
    pのポインタのポインタのポインタ

    何が難しいんだか 

225 デフォルトの名無しさん [sage] 2009/11/23(月) 11:47:24 ID: Be:
    配列?に置き換えれば、少しはわかるかも 

226 デフォルトの名無しさん [sage] 2009/11/23(月) 11:52:58 ID: Be:
    わかりやすいポインタ講座

    アドレス10000に書いてました
    xをみつけたいならアドレス20000を見ろ

    アドレス20000に書いてました
    xをみつけたいならアドレス30000を見ろ

    アドレス30000に書いてました
    xをみつけたいならアドレス40000を見ろ

    アドレス40000に書いてました
    xの値は0xABCDです。 

227 デフォルトの名無しさん [sage] 2009/11/23(月) 11:55:37 ID: Be:
    よくある間違いは領域確保してませんでしたって奴じゃろ 

「アドレス参照渡し」ってのもなんか微妙だ。

2009年11月24日

■_

Masaki Iwata's blog : CPU を食べているドライバは誰? ・「な」
24日ですので日経ソフトウエアの発売日。ということで今月も買ったわけなのですが。 連載記事の「魔法の言葉,関数型言語を学ぼう 」でちと気になる記述が。

もう一歩上級を目指すためのワンポイント講座

Gaucheでは、数値を「正確な数」と「不正確な数」に分けています。
正確な数とは整数と有理数で、不正確な数とは実数(浮動小数点数)と複素数です。

「正確な数」と「不正確な数」って exact number と inexact number だよなあ 「な」はなしで「正確数」とか「不正確数」ではなかったけと思い調べてみると Scheme 翻訳規約 やっぱりそれっぽい。が、「プログラミング Guache」があったのを思いだし 引っ張り出して確認してみると

プログラミングGauche p.95

詳しくは第3部「12章 数値」で説明しますが、Gaucheでは数値に「正確な数」と「不正確な数」
の区別があります。「不正確な数」は」浮動小数点数に代表される、演算の際に誤差が入る計算
に使います。

んで、

p.159
12.3 正確数と不正確数

1と1.0は両方とも整数ですが、Schemeでは前者を「正確な整数」、後者を「不正確な整数」とし
て区別します。より一般的に言えば、Schemeの数値には、正確数(exeact number) と不正確数
(inexact number)という属性がついています。

正確数とは、誤差を含まない数のことです。正確数どうしの計算は通常は正確数になります。
Gaucheでは、正確数は<integer> 型の整数、もしくは<rational>型の有理数として
表現されています。

一方、不正確数とは単に正確数でない数のことです。Gaucheでは、不正確数は<real>型の
浮動小数点数、もしくは<complex>型の複素数として表現されています。

目次には「な」のあるものないもの両方とも載っていました。 うーむわかりゃん。

・Number
だいぶ前に出たオシム前日本代表監督が表紙の号を読んだ。 ベイスターズの監督も努めた森氏が、ライオンズOB で現在監督をしている 秋山 (ホークス)と渡辺(ライオンズ)について寸評をしているのが面白かった。 秋山が監督なるとは思わなかったとか。ただし、コーチ→二軍監督→一軍監督と ステップを踏んだのは彼にとっては良かっただろうと。投手の扱いについては見当の余地ありとか (今シーズンの馬原とか)。

■_ 出来が良くないので公開するのが恥ずかしい?

日本だけじゃないんですねえ。

"I am not proud of my code" excuse for not open sourcing an application - Stack Overflow

I have asked a few developers who produced software they no longer maintain or let die, 
why they don't open source the software and let other developers take it forward and 
enhance it. Or at least not let it disappear.

Most of the excuses were about the quality of the code. They don't want to open source 
because they are ashamed of what they have coded. In my opinion, if the software works, 
people are downloading it and using it, that says enough about the software. No one is 
proud of their own code. If anyone looks at their year old code, you surely decide you 
can do better now. I have used some good software no longer exists. I find it this to 
be a waste of good resources.

Why would some developers prefer to let their software disappear instead of giving it 
to the public? One reason I can think of is that they used someone else's IP and they 
don't want to be exposed. Should developers be encouraged to open source their 
software if they have no intentions of profiting from it now or in the future?

Some people really might not want their code to be criticized and don't feel like 
cleaning it up. It is somewhat legitimate though I agree if does prevent useful code 
from getting out to the community. It's not prima facie evidence that they are using 
IP that they shouldn't though.


Maybe because open a software's code demmands some effort they're not willing to spend.

If someone really wants to release the code but are ashamed of it, the rational 
solution is to remove all traces of their authorship from the source code, then either 
release it into the public domain, or assign the copyright to someone else.

That aside, there are all sorts of possible reasons for an author not releasing source 
code:

    * Maybe the code really is crap and the author doesn't want a potential future 
      employer to associate him/her with it.

    * Maybe the author is unduly sensitive about (possible) criticism from his/her 
      peers.

    * Maybe the author thinks the code is not worth the effort of saving, and is 
      trying to stop other people wasting their time on it.

    * Maybe there are potential IP issues that the author doesn't want to spend time 
      sorting out:

          o some open source code might have been copied without proper attribution or 
            under the wrong license,

          o some closed source code might have been copied,

          o some patented method might have been used. (Aside: can anyone ever be sure 
            that their code doesn't uses a patented method? No!)

          o the author really cannot remember what short-cuts he/she might have taken 
            N years ago ...
    * Maybe the code contains secrets that the author doesn't want to reveal:
          o maybe it doesn't do what he/she claimed it does in some research paper, or 
            some such

          o maybe he/she thinks it might give competitors (e.g. other academics) an 
            advantage to see the "secret sauce" techniques his code uses.

    * Maybe the author dreams that some day he/she will be able to sell the code for 
      big pots of money.

    * Maybe the author dreams that some day he/she will find the time and energy to 
      fix the code, release under an open source license and become as famous as Linus. 
      (Yea .. that Linus!)

Or maybe the author is simply just not interested, and the "I'm ashamed of my 
code" excuse is just a ploy to make you go away :-).

I can understand where your coming from. The software works and that's what really 
matters. I can also understand where the developers come from. Many programmers 
develop bad habits while coding (ie. not commenting). I'm guilty of this myself 
sometimes. In my opinion, I don't think this should limit them to keeping their 
applications closed source. If you open your source, you open the doors to all new 
sorts of possibilities. If your not going to work on a certain program anymore, why 
not release the source? People can take what you know, apply it, make it better, and 
ultimately keep your application up to date and better than before. Overall, 
developers should be more open about releasing their source code, especially if no 
profit is ever intended.

I can completely understand this.

I wrote some software ten years ago for a volunteer organization. They are still using 
it and it 'works'. But it is ugly. I know so much more now about how to design 
software. It is painful to even have to make updates and changes to it. I'd love to 
take some time to clean it up, but I just don't have time. I don't really want anyone 
else to take over the project because I am embarassed to have my name associated with 
the code -- even though my name isn't actually in the code. It still reflects on me 
and even though I may know better now.

Logically, I know better. It is stupid to think this way. But I can't overcome the 
psychology. It is very real and it is a tough dilemma. I wouldnt assume issues with IP 
or hidden motives.


No one is proud of their own code? Don't believe you.

We will encourage you to develop the three great virtues of a programmer:
laziness, impatience, and hubris.
-- Larry Wall

I have answered the questions posted, in order. Yes, these are opinionated.

[Do you have this as a study somewhere? It would be interesting to see. Just vague 
references and quantifiers aren't very exciting.]

Perhaps the code was written for fun, learning, work-for-profit at the time, because 
"it could be done", or for some other motivational reason. It served a 
purpose; perhaps the purpose is gone -- as well as the incentives behind. It takes 
effort to find old code, publish old code, and answer silly emails or questions about 
old code. (And for some, it takes effort to not care about what others think.)

I would be hesitant to jump on the idea that the code kept hidden "violates 
IP". This is an unfair and unfounded assumption without better proof.

Encouraged? Perhaps. Forced? No. Code is a creation and, like any art, is is a product 
of the creator. Unless they have alright assigned away the rights, it is the authors 
work. Perhaps it is deemed to be awful and forever buried away -- so be it. The same 
happens to other forms of art all the time.

まあまったく同じ事情ではないでしょうけど。

■_ くろじゃ

Java 7に結局入るとかで。

InfoQ: JDK 7が、突然"単純な"クロージャをサポート、しかしリリースは、2010年の終わりに。
Devoxxでの発表の後に、 3つのクロージャの提案 の1つ(BGGA, Bracha, Gafter, Goslingと von der Ahéの4氏のイニシャルから名付けた)の共同起案者である、Neal Gafter氏は、 “単純化された提案”をリリースした:

    この修正版における変更点は

        * control invocation syntax は別仕様とする。
        * 用語 クロージャ リテラルを ラムダ式に変更。
        * Clangから緩く拝借して、ラムダ式のシンタックスを全面的に見直した。今や、ラムダ式には
          2つの形式があり、 expression lambda は、制御された式を持ち、一方、 statement lambda
          は、制御されたステートメントを持つ。
        * 用語 クロージャ・オブジェクト は、 関数オブジェクトに変更。
        * 用語 クロージャ・コンバージョン は、 ラムダ・コンバージョンに変更になり、control
          invocation syntaxによる別の ブロック・コンバージョンもある。
        * returnステートメントに新たなセマンティクスを追加した。それは、今やstatement lambda
          (ステートメント・ラムダ)から戻るために使うことができる。
        * Scala のようにjava.lang.Unreachable が java.lang.Nothing と名称変更された。
        * 型名としてのnullは、サポートされなくなった。これまでのバージョンでは、なにもスロー
          できない時に、プレースホルダとして、例外の型にnullを使った。今やタイプ Nothing がそ
          の目的を果たす。
        * restrictedが見直された。 restricted と unrestricted な関数の型やクロージャという概念
          はなくなった。今やすべてのラムダ式は、restrictedである。これまでの仕様の unrestricted
          クロージャと同等なものは、 control invocation syntaxを使って、メソッドに渡せばよい。
        * メソッド・参照 のサポートを追加: 新たに導入されたトークン # を使って、関数としてメソ
          ッドへの参照を扱うのをサポートする。シンタックスは、 Javadocにおけるクロス・リファレ
          ンス と FCM 提案 から借りた。

良くわからん。Javaはほとんど使わんしなあ(機会がない)。

■_ xgawk for win

XMLgawk for Windows Hello developers, As mentioned in my mail of 5 November, I managed to build XMLgawk for native Windows :-) . つーことでチェックしてみた。

Building XMLgawk for Windows | Wimdows

Introduction

XMLgawk is an experimental extension of the GNU Awk interpreter. Main developers are 
Jürgen Kahrs and Andrew Schorr. The homepage for XMLgawk is 
http://home.vrweb.de/~juergen.kahrs/gawk/XML/

The implementation of XMLgawk consists of an executable gawk.exe and a xml extension. 
The extension is a dynamic library: xml.dll.

This page shows how to build gawk and the xml extension for native Windows. We will 
use the MinGW environment to build the binaries.

Starting point for the work is the informaton given in the files README_d\README.pc 
and README_d\README.pcdynamic that are included in the gawk source package. This 
infomation appeared to be quite helpful.

You may notice that some of the patches I applied are a bit rough. But, OK, I wanted 
to make some miles in a limitted time and I think the gawk and xml dev's and me will 
be able to smooth the sharp edges in the near future.

Recipe

Preparation of the environment

(略)

Preparation of the source files and makefile for gawk

(略)

Edit Makefile

(略)

Enable dynamic support: remove comment characters (#) to obtain the following:

(略)

Edit main.c

(略)

Edit ext.c

(略)

Build gawk

Run MSYS and run make mingw32. The build log is shown here. The result of the build 
consists of the binaries gawk.exe and pgawk.exe, libgawk.a and gawk.exp. The library 
file libgawk.a is needed to compile the extensions.
So far, so good!

Preparation of the source files and makefile for the xml extension

Most files needed to make the extension are in the sub directory extension. Hence, we 
cd to this sub directory.

Create Makefile

(略)

Run xml-conv-enc

(略)

Edit xml_interface.c

(略)

Build the xml extension

(以下略)

ふむ。予想の範囲といえば予想の範囲。しかし iconv と gettext の両方の DLL を使うというのもあんまり気乗りせんなあ。

■_ The Ruby Revolution, take II

The Ruby Revolution (take 2) | Merbist
Rails 3, Ruby & MacRuby news – tutorials – consulting – training
Merbist

The Ruby Revolution, take II

My recent ‘Ruby revolution being over' blog post generated quite a lot of comments.

http://merbist.com/2009/11/09/the-ruby-revolution-is-over
http://merbist.com/2009/11/09/the-ruby-revolution-is-over/#comments

Let's be honest, I did not expect less from the readers.

However, I noticed three types of reactions I would like to address:

However,
I noticed three types of reactions I would like to address:
わたしが注目するリアクションには三種類あることに気がつきました

    * It was not a Ruby revolution, it was a Rails revolution
      (Ruby 革命じゃなくて Rails 革命だろ)
    * The revolution has stalled due to no major enterprise backing
      (major enterprise backing がなかったために革命は頓挫してしまった)
    * The revolution will only be over when we will reach a greater adoption

First of all, as Joe correctly mentioned, for me, the revolution is not about 
specifics or individuals. It's really about the big picture.

http://merbist.com/2009/11/09/the-ruby-revolution-is-over/#comment-817

まず始めに、Joe が指摘したように
この革命は specifics や 個人についてのものではありません。

The influence Ruby had and still has on the IT world seems to be undermined by some.

Ruby のIT業界に対する影響は一部の人によって underminded され、いまもそのままのたようです。

Ruby is a dynamic, truly Object Oriented programming scripting language designed for 
humans first.

Ruby は動的で、本物のオブジェクト指向プログラミングスクリプティング言語であり
人間第一で設計されました。

The real paradigm shift is in the fact that Ruby was designed to make programming fast, 
enjoyable and easy instead of being optimized for the machines running it.

本当のパラダイムシフトは、プログラムを実行するマシンのためにに最適化するのではなく、プ
ログラミングを早くて楽しめる簡単なもの (fast, enjoyable and easy) にするためにRuby が
設計されたという事実の中にあります。


This is for me the essence of the revolution and it is meant to transcend the scope of 
the Ruby language.

これはわたしにとってのRuby 革命のエッセンスであり、
scope of the Ruby language を越えることを意味しています。


The way I see it, Yukihiro Matsumoto (Matz) is more of an artist than a technician. He 
had a vision for software development. Programming languages cannot be 
optimized/designed for both machines and humans, the language designer has to choose 
which one he wants to privilege.

わたしのみるところでは、まつもとゆきひろ氏 (Matz) は technichan というよりは artist で
す。彼はソフトウェア開発についての vision を持っています。プログラミング言語を機械と人
間との両方にとって最適なものにしたりそのように設計したりすることはできません。言語の設
計者は自分がどちらを優先したいのかを選択しなければなりません。

Most programming languages believe that it's up to the programmer to make an extra 
effort since he is smarter and easier to optimize than a machine. Matz questioned this 
approached and decided to turn things around. The result is one of the reasons why 
developers seem to just fall in love with Ruby.

ほとんどのプログラミング言語ではプログラマーは賢いので機械にやらせるよりも最適化を簡単
に行えるから、extar effort を行うことができるということを信じられていますMatz はこのア
プローチに疑問を感じ、turn things around のための決断をしました。その結果こそが開発者
が Ruby との恋に落ちたように見える理由のひとつなのです。

**It was not a Ruby revolution, it was a Rails revolution.
(Ruby 革命じゃなくて Rails 革命だろ)

I am not denying that there *also* was a Rails revolution.

Rails 革命「も」あったということは否定しません。

But if you look at it, Rails and its revolution are a direct effect from Ruby's 
revolution.

しかしあなたがそういう見方をするのであれば、
Rails と Railsによる革命は Ruby による革命の影響を直接受けているのです。

One might argue that it is actually an extension of Ruby's philosophy. But what is 
Rails if not a web framework designed to make web development fast, easy and enjoyable?

Ruby の哲学の拡張ではないかという主張をする人がいるかもしれません。
しかし、web 開発を高速に行うために設計が為された web フレームワークでなければ
Rails のなにが easy であり enjyoable なのでしょうか?

Without Ruby there would not have been Rails and that was my point, the underlying 
revolution comes from the language itself.

Ruby なくしては Rails は存在し得なかったでしょうし、
わたしの point であった言語それ自身に拠った革命もまたなかったでしょう。

**The revolution has stalled due to no major enterprise backing.
(major enterprise からの backing がなかったために革命は頓挫してしまった)

That's an interesting comment. It is true that .NET and Java are still dominating the 
enterprise world. But let's be clear, Ruby was not designed to please “suit people”.

これは興味深いコメントです。.NET や Java がまだまだ企業方面で支配的であるのはその通り
です。しかしはっきりさせておきたいのですが、Ruby は「スーツ族」(“suit people”) を喜
ばせるために設計されたものではありません。

And to this day, there is still a strong feeling, from some individuals against the 
enterprise.

そして今日に至ってもなお、一部の個人 (some individuals) から企業に対する
strong feeling があります。

In the past, DHH openly said that he did not care nor wanted to hear about the 
enterprise, more recently, Obie Fernandez, during one of his talks said:
“Fuck the enterprise” (49:39).

過去に DHH は
彼が企業に対する考慮もしていないし話を聞いて欲しいとも思わない
と公に発言したことがあります。
more recently, Obie Fernandez, during one of his talks said:
“Fuck the enterprise” (49:39).


But the truth is that Ruby and the so called enterprise, both, are changing.

しかし真実は、Ruby と 企業と呼ばれるものの両方が変わったということなのです。

The smart people in the enterprise world saw potential in Ruby and decided to give it 
a chance. An easy way to include Ruby's philosophy without breaking the fragile 
enterprise equilibrium was to inject Ruby in the midst of well known and respected 
technologies such as Java and .NET. The enterprise can now use “re-branded Ruby 
versions” with “new taste or ‘improved' flavor” like JRuby, Scala, groovy, 
IronRuby.

企業世界にいる賢い人たちはRuby の潜在能力を見て、機会を与えることにしました。壊れやす
い企業の equilibrium (釣り合い、平衡) を壊すことなく Ruby の哲学を取り入れる簡単な方法
はJava や .NET のような良く知られていて respect されている技術の真ん中に Ruby を注入 
(inject) してしまうことです。企業は今や JRuby や Scala、groovy、IronRuby のような
“new taste or ‘improved' flavor”が付け加えられた “re-branded Ruby versions”を使う
ことができるのです。

I work for some enterprise clients and I can tell you that they ‘also' use Ruby. 
Mainly because developers love the language.

わたしはいくつかの企業クライアント向けに仕事をしていますが彼らも「同様に」Ruby を使っ
ているということが言えます。その理由は主に開発者たちが Ruby という言語が大好きだったか
らです。

Microsoft, Apple and SAP investing in their own implementation of the language is yet 
another example that the enterprise recognizes the value of Matz's work.

Microsoft、Apple、SAP がそれぞれ自分たちの言語実装を行った処理系を持つということは
Matz の work の価値を認めたというべつの例なのです。

Nobody can blame them to try to make Ruby fit more their requirements.

So, at the end of the day, Ruby is not the #1 enterprise language and Rails isn't used 
by the large majority of enterprise web apps, but that is NOT the point. Ruby has 
influenced the enterprise and we will see its effects for many years.

So, at the end of the day, Ruby は No.1 の企業言語 (enterprise language) ではありませ
んし、 Rails は large majority of enterprise の webアプリには使われていません。しかし
それは問題では「ありません」。Ruby は企業に影響を及ぼし、わたしたちはその効果を何年に
も渡って目撃することになるでしょう。

**The revolution will only be over when we will reach a greater adoption
(革命はより広く受け入れた時点で終わってしまうだろう)

Saying that is missing the point entirely. A revolution is a step towards a situation 
change. Things don't change right away after a revolution. It takes a long time for 
mentalities to evolve and for people to change their habits.

このように言ってしまうことはポイントを完全に見失ってしまっています。革命とは situation 
change に向かう step です。革命の後ではものごとは正しく変わりません。メンタリティを 
evolve したり人の習慣を変えさせるには長い時間を要するのです。

The consequences of a revolution are to be studied over the decades following the 
event. Take smalltalk for instance. Smalltalk adoption was not that great, however it 
brought a paradigm shift that directly influenced languages such as Ruby, Python and 
Objective-C.

革命の consequences (結果、影響) は革命後十年以上にわたって起こる事象によってわかりま
す。smalltalk を例にとってみましょう。Smalltalk は広い範囲で採用されることはありません
でしたが、Ruby や Python、Objective-C のような言語に直接影響を及ぼしたパラダイムシフト 
(paradigm shift) を起こしました。

So, again, do not focus on the adoption but instead look at the influence of the Ruby 
revolution and the ripple effect around it.

ですから繰り返しますが、受け入れられるということにフォーカスするのではなく、Ruby 革命
の影響とそれに関係する ripple effect (連鎖反応、波及効果) に注目してください。

revolution, ruby

This entry was posted on Monday, November 16th, 2009, 08:05 and is filed under Misc, 
ruby. You can follow any responses to this entry through RSS 2.0. You can leave a 
response, or trackback from your own site.

■_ 本日の巡回から

2009年11月23日

■_

・ファイターズ中田
なんかあの走塁でずいぶん叩かれてますね。


まつもとさんの retweet で知ったのですが Twitter / Yukihiro Matsumoto: RT @timbray: URGENT: Anyon ... RT @timbray: URGENT: Anyone reading this in Tokyo, please check http://apachenews.org/ Suicide-prevention in order? という情報がありまして、 問題のページ Apache News Online には I WILL COMMIT SUICIDE で始まるなんとも穏やかでない文章が。 その後なにも情報が入ってこなかったので気になっていたのですが (とはいえ面識もない方なので自分はどうにもできなかったのですけど)、 夜になって reddit にスレッドが立っているのに気がつきました。 He will commit suicide? : programming スレッドを追いかけてみると


diminoten comments on He will commit suicide?
BAM, Reddit to the rescue (emphasis mine)

    Could not COMMIT SUICIDE
    Dear the readers of Apachenews.org.

    I am open to network with all professionals across various disciplines as it is my 
    strong belief that we are all citizens of the world and we can all learn/gain from 
    each other in a mutually beneficial manner. Every new person met has the potential to 
    be a true #MASTER MIND#, you will only discover this by getting out and interacting.

    Please relieve that I, Tetsuya Kitahata, could not do the suicide because of the 
    lack of money for alcohol. So many responses were there that I received. Thank you to 
    ALL. Yours,

    -- Tetsuya Kitahata -- mailto:kitahata@99.alumni.u-tokyo.ac.jp -- http://www.linkedin.com/in/tetsuya

Huge props to all who sent emails, maybe you saved his life.

という記述が。一安心。ということでいいのでしょうか。

■_

スレ立てるまでもない質問はここで 102匹目
208 デフォルトの名無しさん [sage] 2009/11/22(日) 23:08:47 ID: Be:
    プログラミング言語にハッシュというデータ型がありますよね。rubyとかで{var=>value, hoge=>foo}のように表す型。
    これってハッシュ関数(メッセージダイジェスト)のハッシュという言葉と関係あるんですか?
    英語表記も両方Hashのようですが。 

209 デフォルトの名無しさん [sage] 2009/11/22(日) 23:14:15 ID: Be:
    データ型のハッシュは、ハッシュテーブルの略です 

210 デフォルトの名無しさん [] 2009/11/22(日) 23:14:36 ID: Be:
    関係ある。
    valueとfooを結び付けると検索するときvalueがどこにあるのか探すのが大変なので
    valueをハッシュ関数で潰した値とfooを結び付ける。 

211 デフォルトの名無しさん [sage] 2009/11/22(日) 23:21:02 ID: Be:
    >> "hello".hash
    => 706225659
    というハッシュ値が使われてる 

212 208 [sage] 2009/11/22(日) 23:27:41 ID: Be:
    ありがとうございます。

    >>209
    なるほどハッシュテーブルの略でしたか。

    >>210
    >>211
    う~ん難しい…
    {"hello"=>value}というデータがある時に、
    内部では706225659というアドレスに変換してそのアドレスにvalueが格納されるという感じでしょうか? 

213 デフォルトの名無しさん [] 2009/11/22(日) 23:32:08 ID: Be:
    >>212
    706225659をそのまま使うわけじゃなくmod 256とかするだろうけど。 

214 デフォルトの名無しさん [sage] 2009/11/22(日) 23:32:11 ID: Be:
    アドレス? 

215 デフォルトの名無しさん [] 2009/11/22(日) 23:34:29 ID: Be:
    ハッシュテーブルが分かってるのに、なんで後半の質問が出てくるんだろう。。 

216 デフォルトの名無しさん [sage] 2009/11/22(日) 23:34:40 ID: Be:
    ハッシュテーブルを知らんのかな? 

217 デフォルトの名無しさん [sage] 2009/11/22(日) 23:34:50 ID: Be:
    情報処理の免許を持ってない奴はプログラムしてはいけないと思うんだ
    基本的な事すらできてないからいちいち人に聞かなきゃいけない 

218 デフォルトの名無しさん [] 2009/11/22(日) 23:36:06 ID: Be:
    免許利権 

219 デフォルトの名無しさん [sage] 2009/11/22(日) 23:40:34 ID: Be:
    ひがむなよwww 

220 デフォルトの名無しさん [sage] 2009/11/22(日) 23:41:57 ID: Be:
    ドカタに免許なんていらないだろ 

221 212 [sage] 2009/11/22(日) 23:42:33 ID: Be:
    ハッシュテーブルの意味をちゃんと理解できてなかったみたいです。
    ちゃんと勉強しないと駄目ですね…出直してきます 

224 デフォルトの名無しさん [sage] 2009/11/22(日) 23:45:07 ID: Be:
    wikiいわく
    ハッシュテーブルはキーをもとに生成されたハッシュ値を添え字とした配列である。
    だそうだ 

225 デフォルトの名無しさん [sage] 2009/11/22(日) 23:48:47 ID: Be:
    その実装の話だろ 

228 デフォルトの名無しさん [sage] 2009/11/23(月) 00:19:12 ID: Be:
    >>220
    でもなあ。
    本物の土方さんの監督には資格必要じゃなかったっけ。
    この業界にもいるんじゃないかなと切に思ってみたり。 

229 デフォルトの名無しさん [sage] 2009/11/23(月) 00:21:59 ID: Be:
    監督じゃなくてもユンボだのトラックだの玉がけだの、ドカタは資格のかたまりだよ
    バイトしたからわかる 

230 デフォルトの名無しさん [sage] 2009/11/23(月) 00:24:24 ID: Be:
    ActiveReportsFor.NETの使い方はここで質問しても大丈夫ですか?

231 デフォルトの名無しさん [sage] 2009/11/23(月) 00:26:01 ID: Be:
    せめて使ってる言語のスレで聞けば? 

232 デフォルトの名無しさん [sage] 2009/11/23(月) 00:27:07 ID: Be:
    なるほど。ありがとうございます。 

233 デフォルトの名無しさん [sage] 2009/11/23(月) 00:35:20 ID: Be:
    本物の土方=命に関わる業務

234 デフォルトの名無しさん [sage] 2009/11/23(月) 04:50:35 ID: Be:
    ハッシュよりもハシシ。 

235 デフォルトの名無しさん [sage] 2009/11/23(月) 07:05:19 ID: Be:
    >>221
    言語のハッシュ型の方が、焦点のボケた思いつきっぽい部分があって、
    あなたのせいではないかも知れませんよ。 

236 デフォルトの名無しさん [sage] 2009/11/23(月) 10:10:01 ID: Be:
    >>200
    これはまた… 20年くらい前のクソゲーが大量生産されそうな見た目だな。 

C++0x 7

551 デフォルトの名無しさん [sage] 2009/11/23(月) 07:44:03 ID: Be:
    混乱の元になるのに、そもそも、
    なんでわざわざ既に別の意味で使われてる&に、
    参照の意味を持たせたのだろうか? 

552 デフォルトの名無しさん [sage] 2009/11/23(月) 07:50:00 ID: Be:
    タイプコンストラクタと演算子は混同しえないから 

553 デフォルトの名無しさん [sage] 2009/11/23(月) 10:56:35 ID: Be:
    それで混乱するような奴はどっちにしろまともに使いこなせない言語だからいいんじゃね 

554 デフォルトの名無しさん [] 2009/11/23(月) 11:06:44 ID: Be:
    禿が考えてたのは、もともとこんな発想だろ
    void a(int*);
    a(&b);
    ↓
    void a(int&);
    a(b);
    つまりアドレス演算子を関数側でつけるってこと

    既に別の意味といえば & ならビット AND にも使われているわけで
    そんなの気にしだしたらきりがない 

555 デフォルトの名無しさん [sage] 2009/11/23(月) 11:09:00 ID: Be:
    *だって別の意味に… 

556 デフォルトの名無しさん [sage] 2009/11/23(月) 11:12:27 ID: Be:
    別の意味を考えて赤面する美少女中学生 

557 デフォルトの名無しさん [sage] 2009/11/23(月) 11:30:45 ID: Be:
    いやいやそういう意味じゃないって! 

使ってない記号といったら $ とか @ 位だからなあ。



【初心者歓迎】C/C++室 Ver.69【環境依存OK】
963 デフォルトの名無しさん [sage] 2009/11/20(金) 21:00:34 ID: Be:
    関数の戻り値は、通常 値渡しですが
    100Mほどのデータをもつクラスでも値渡しになりますか。
    (値渡しのコストを下げるために) もし100Mがポインタに入っていて、
    auto変数でリターンするとデストラクタが働いてメモリは解放されてしまいますが
    newで確保した物をリターンすると、それは解放できなくなりますか。 

964 デフォルトの名無しさん [sage] 2009/11/20(金) 21:03:27 ID: Be:
    戻り値にクラスを持ってこずに引数を参照渡しにすればいいのですが
    変数を用意する事無しに、リターンがクラスになっていると便利なことがあるんです。 

965 デフォルトの名無しさん [sage] 2009/11/20(金) 21:27:13 ID: Be:
    戻り値がクラスというのは意味不明。

    オブジェクトを返すとして、たとえば、
     LARGE func() { return * new LARGE; }
    というのは結局コピーしてるし、メモリが回収不能になるので、絶対にだめ。

    LARGE & func( LARGE & inout ) {
     //LARGEを使った処理。
     return inout;
    }
    として、外で大きなデータを用意してやるか、
    funcで全く新しいオブジェクトを作成したいと言うなら、newしてポインタを返せばよい。 

966 デフォルトの名無しさん [sage] 2009/11/20(金) 21:38:14 ID: Be:
    >>965
    Qtでこんな関数をオーバーロードしろって言われてるんだけど、
    何を返せばいいの?

    QSize sizeHint(引数略)
    {
      return ?
    } 

967 デフォルトの名無しさん [sage] 2009/11/20(金) 22:05:09 ID: Be:
    QSizeオブジェクトでいいと思うよ。 

968 デフォルトの名無しさん [sage] 2009/11/20(金) 22:16:32 ID: Be:
    え? でも>>965・・・ 

969 デフォルトの名無しさん [sage] 2009/11/20(金) 22:18:16 ID: Be:
    QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const

    あとこんなのもあるんですが・・・

970 デフォルトの名無しさん [sage] 2009/11/20(金) 22:20:50 ID: Be:
    QSizeオブジェクトを返すことが、ライブラリによって強制されてるんだから、従えよ。 

971 デフォルトの名無しさん [sage] 2009/11/20(金) 22:21:12 ID: Be:
    お前が何を聞きたいのかわからない 

972 デフォルトの名無しさん [sage] 2009/11/20(金) 22:23:15 ID: Be:
    > というのは結局コピーしてるし、メモリが回収不能になるので、絶対にだめ。
    ってかいてるじゃないですか

973 デフォルトの名無しさん [sage] 2009/11/20(金) 22:23:59 ID: Be:
    QSizeって大きくないでしょ。(というか100Mというサイズはどこから)
    値で返しても何も問題ないじゃん。 

974 デフォルトの名無しさん [sage] 2009/11/20(金) 22:40:44 ID: Be:
    それ以前に

    QSize sizeHint(引数略)

    をオーバーロードするのに、
    戻り値を参照やポインタにはできんだろ。
    オーバーロードのルールを思い出すのだ。 

975 デフォルトの名無しさん [sage] 2009/11/20(金) 22:42:16 ID: Be:
    いや、戻り値を変えられないのはオーバーライドじゃろ。 

976 デフォルトの名無しさん [sage] 2009/11/20(金) 22:47:28 ID: Be:
    たまにいるよね(値|参照)(返し|渡し)の違いがわからない人って
    まあわからないようなレベルでできることなんて高が知れてるから分かるまで値返しでいいんじゃないかな 

■_ どこもきびしいなあ

reddit から。


A programmers salary : programming

I'm currently studying a software engineering degree at university. I am wondering who 
here has a job in the programming industry? What do you? Was it hard to get there? How 
much do you (sic) earn?

Programming salaries vary heavily across regions. You are looking at about 70k-100k in 
northwest (think Seattle), $100k+ in the bay area and NY (Cost of living negates it), 
and as low as $30-$50k in heart land.

Getting a job is pretty easy at most companies, your first job will probably be 
through a consulting company, they basically buy and sell bodies to companies that 
need programmers, but don't understand how to do things right. These companies are NOT 
picky, and if you have a pulse and know how to boot your computer you can get in.

Don't expect to be working on anything cool. Most programming jobs are mundane 
automation, working with service platforms, or building reporting systems.


Graduated with BS in CS from an un-prestigious school and only slightly above average 
grades. My entry level in 98 was about $40K (salaried) with a very small company I had 
interned at for several previous summers. After the Dot.Com implosion, I contracted 
through a company sporadically for a number of years with about the same or a little 
more income, but at hourly rates. For the last half decade at a very large corp, I've 
gone up quite a bit more. This is in a major metro area in the Pacific Northwest.


They would have been 2 years ago. Globalization is really hurting salary right now.


Yep, I'm seeing contracts around Portland that pay $30/hour for dev work and recently 
saw a QA contract that was paying $15/hour - this is without benefits. $30/hour was 
about what was being paid during 2002 when things were quite bad so we're back there 
minus the inflation that's occurred since then.

以下たくさん。

■_ 予告編

Guido ぱぱとは別の意味で訳すのに大苦戦。 たぶん、shibuya.lisp#4 で竹内先生が言及していた文書ってこれのことだと思うのだけど。

LISP History
"Early LISP History (1956-1959)

by Herbert Stoyan University of Erlangen-N"urnberg Lehrstuhl f"ur K"unstiche 
Intelligenz Am Weichselgarten 7, D-91058

Erlangen Germany

ABSTRACT

This paper describes the development of LISP from McCarthy's first research in the 
topic of programming languages for AI until the stage when the LISP1 implementation 
had developed into a serious program (May 1959). We show the steps that led to LISP 
and the various proposals for LISP interpreters (between November 1958 and May 1959). 
The paper contains some correcting details of our book (32).

本論文では、McCarthy の first reseach から1959年5月に LISP1 serious program として実装
されるまでのLISP の開発について説明し、1958年11月から1959年5月までの間の LISPへ至るス
テップとLISP インタープリターに対する様々な提案をお見せします。
The paper contains some correcting details of our book (32).

INTRODUCTION

LISP is understood as the model of a functional programming language today. There are 
people who believe that there once was a clean "pure" language design in the 
functional direction which was comprised by AI-programmers in search of efficiency. 
This view does not take into account, that around the end of the fifties, nobody, 
including McCarthy himself, seriously based his programming on the concept of 
mathematical function. It is quite certain that McCarthy for a long time associated 
programming with the design of stepwise executed "algorithms".

LISP は今日、関数型プログラミング言語のモデルとして理解されています。AI-programmers in 
search of efficiency によって comprised されたfunctional direction における clean で 
“pure” な言語のデザインが存在していたと信じている人たちがいます数学的な関数のコンセ
プトにきちんと基づいたものである、彼のプログラミングについての視点 (view) は 1950年代
の終わりの時点では McCarthy 自身も含めて誰からも評価されませんでした。
It is quite certain that McCarthy for a long time associated programming with the
design of stepwise executed "algorithms".

  

■_ 本日の巡回から

■_ 空白重要

昨日書いた、ソースコードの読みやすさに空白が云々ですが お二人から情報をいただきまして判明しました。

ソースコードのコメントよりも空白行のほうが理解を助けるという研究結果:森崎修司の「どうやってはかるの?」:ITmedia オルタナティブ・ブログ 経由で、



Learning a Metric for Code Readability

In this paper, we explore the concept of code readability and investigate its relation 
to software quality. With data collected from 120 human annotators, we derive 
associations between a simple set of local code features and human notions of 
readability. Using those features, we construct an automated readability measure and 
show that it can be 80% effective, and better than a human on average, at predicting 
readability judgments. Furthermore, we show that this metric correlates strongly with 
three measures of software quality: code changes, automated defect reports, and defect 
log messages. We measure these correlations on over 2.2 million lines of code, as well 
as longitudinally, over many releases of select projects. Finally, we discuss the 
implications of this study on programming language design and engineering practice. 
For example, our data suggests that comments, in of themselves, are less important 
than simple blank lines to local judgments of readability.

全体は、右のほうにあるリンクからたどって 19ドル払わないと読めないようですね。 まあそのくらいならいいかなあ。

2009年11月22日

■_

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


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


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


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

■_ 本日のム板から

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

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

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

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

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

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

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

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

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

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


なんという流れかw

■_

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

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

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

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

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

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

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


つれづれ - みねこあ

2009-11-21 ■つれづれ

その132

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

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

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

その137

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

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

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

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

その142

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

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

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

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

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

■_

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

Journal of rurban (7989)

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

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

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

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

■_ 本日の巡回から

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

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

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

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

    2009年11月21日

    ■_

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

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

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

    ■_ 今日のム板から

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

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

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

    ■_

    あとでよむ

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

    ■_ 本日の巡回から

    ■_ なんつーか

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

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

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

    ホームへ


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

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